我正在关注Microsoft的docs页面 https://docs.microsoft.com/en-us/office/dev/add-ins/word/get-the-whole-document-from-an-add-in-for-word?view=office-js
我试图在Office JS插件中获取当前打开的文档,以使用POST请求将其发送到另一台服务器。
我添加了来自文档的代码片段,与文档相同。我唯一的区别是我正在使用react,但这不应影响office-js API
Office.context.document.getFileAsync(
Office.FileType.Compressed,
{ sliceSize: 100000 },
result => {
console.log(result);
但是。结果为“失败”,并且这里有一个错误
code: 5001
message: "An internal error has occurred."
name: "Internal Error"
status: "failed"
我试图在办公室在线加载插件,然后该功能正常工作。现在仅在MacOS版本的办公室更新中不起作用
答案 0 :(得分:0)
对于许多Mac,最大切片大小为65536。这通常会导致“失败”状态。请参见“备注”下的https://docs.microsoft.com/en-us/javascript/api/office/office.document?view=office-js#getfileasync-filetype--options--callback-。