我计划创建一个powerpoint插件,将自动初始化与数据库中的数据ppt。如何在幻灯片中插入/更新图表/表格?
谢谢!
发布于 2021-04-28 00:02:21
您可以使用OfficeJS APIs。例如,以下函数使用Office将图像插入到文档中。注意:
setSelectedDataAsync请求的第二个参数的coercionType选项指示要插入的数据类型。asyncResult对象封装setSelectedDataAsync请求的结果,包括请求失败时的状态和错误信息。function insertImageFromBase64String(image) {
// Call Office.js to insert the image into the document.
Office.context.document.setSelectedDataAsync(image, {
coercionType: Office.CoercionType.Image
},
function (asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
showNotification("Error", asyncResult.error.message);
}
});
}你可以在Tutorial: Create a PowerPoint task pane add-in中阅读更多关于它的内容。
发布于 2021-04-28 22:34:38
无论是Office.js接口还是PowerPoint JavaScript接口目前都不支持在PowerPoint中添加表格,目前只能在Word和see here中执行此操作。一种可能的解决方法是使用PptxGenJS之类的内容在临时ppt文件中生成一个表,然后使用PowerPoint JavaScript API将带有该表的幻灯片从临时ppt复制到运行插件的ppt。
发布于 2021-04-28 00:02:12
要在PowerPoint中添加内容,请使用Office JavaScript的常用API。从Common JavaScript API object model开始。
https://stackoverflow.com/questions/67276325
复制相似问题