powerpoint - 如何通过 office.js 插件在 powerpoint 中插入图表/表格
问题描述
我计划创建一个PowerPoint插件,它将自动初始化一个包含数据库中数据的ppt。如何将图表/表格插入/更新到幻灯片中?
谢谢!
解决方案
您可以使用OfficeJS API。例如,以下函数使用 Office JavaScript API 将图像插入到文档中。笔记:
coercionType
指定为请求的第二个参数的选项指示setSelectedDataAsync
要插入的数据类型。该
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);
}
});
}
您可以在教程:创建 PowerPoint 任务窗格加载项中了解更多相关信息。
推荐阅读
- javascript - RxJS 链 Promises 传递先前的值
- android - 是否有针对 Android <10 上的任务劫持的修复?
- python - 未捕获的错误:检查时出错:预期 dense_input 的形状为 [null,437] 但得到的数组的形状为 [1,435]
- arcgis-js-api - ESRI JS API 正在剥离 href
- python - 在python中附加空的嵌套列表
- python - 有没有办法指定将日志打印到 python 输出的截止级别?
- c# - 只有assignment、call、increment、decrement、await和new对象表达式可以用作语句[c#]
- arrays - python:存储为数组中元素的数字的比较给出了不正确的结果
- django - django nginx上游在上传大数据时过早关闭连接
- python - 在 Bokeh 中链接缩放工具