insert image programmatically office 365 excel Add-in

允我心安 提交于 2019-12-11 00:29:32

问题


We are developing Office 365 Excel Add-In using office js version 1.1, we are creating table and inserting data using tablerows , now we need to display images in cells in one of column.

can anyone help how we can achieve that using office js?


回答1:


There is a somewhat limited way of doing it using the getSelectedDataAsync API and the ImageCoercuon type. I know that this works on the Desktop but not sure offhand about Office Online, Mac, or iOS. See https://dev.office.com/reference/add-ins/shared/document.setselecteddataasync. To position the image within a cell you will likely need to programmatically select the cell using the ExcelApi (2016+) API paradigm. And unless you know the width and height of the rows and columns, you may need to guesstimate there (or use a very bizzare hack of first setting a chart in place of the desired image, setting its position to be bounded on both sides by the cell, and loading its width and height properties). I'm happy to review your attempt at such code, but it won't be a super straightforward or clean task.

Actual full-fledged support for images is high on our backlo, but not in the product yet.



来源:https://stackoverflow.com/questions/41073931/insert-image-programmatically-office-365-excel-add-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!