以编程方式插入图像Office 365 excel外接程序 [英] insert image programmatically office 365 excel Add-in

查看:122
本文介绍了以编程方式插入图像Office 365 excel外接程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Office js 1.1版开发Office 365 Excel加载项,我们正在使用tablerows创建表并插入数据,现在我们需要在某一列的单元格中显示图像.

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.

有人可以帮助我们如何使用Office js实现这一目标吗?

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

推荐答案

使用getSelectedDataAsync API和ImageCoercuon类型进行此操作的方式有些有限.我知道这可以在桌面上使用,但不能肯定有关Office Online,Mac或iOS的有用信息.参见 https://dev.office.com/reference/add-ins /shared/document.setselecteddataasync .要将图像放置在单元格中,您可能需要使用ExcelApi(2016+)API范例以编程方式选择该单元格.并且,除非您知道行和列的宽度和高度,否则您可能需要在此处进行估算(或使用非常怪异的技巧,首先将图表设置为所需图像的位置,然后将其位置设置为以单元,并加载其宽度和高度属性).我很高兴查看您对此类代码的尝试,但这绝不是一项简单明了的工作.

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.

这篇关于以编程方式插入图像Office 365 excel外接程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆