Office.context.document.getFileAsync 抛出错误 [英] Office.context.document.getFileAsync throwing errors
问题描述
我遇到了一个非常奇怪的问题,当我第三次尝试将 word 文档提取为压缩文件以在我的 MS Word 任务窗格 MVC 应用程序中进行处理时,它会爆炸.
I am getting a very strange issue whereby when I try to extract the word document as a compressed file for processing in my MS Word Task Pane MVC app the third time, it will blow up.
代码如下:
Office.context.document.getFileAsync(Office.FileType.Compressed, function (result) {
if (result.status == "succeeded") {
var file = result.value;
file.getSliceAsync(0, function (resultSlice) {
//DO SOMETHING
});
} else {
//TODO: Service fault handling?
}
});
出现的错误代码是 5001.我不知道如何解决这个问题.
The error code that comes up is 5001. I am not sure how to fix this.
如果您对此有任何想法,请告诉我.
Please let me know if you have any thoughts on this.
其他详细信息:
推荐答案
来自 MSDN:
内存中最多允许有两个文档;否则getFileAsync
操作将失败.使用 File.closeAsync
方法来完成工作后关闭文件.
No more than two documents are allowed to be in memory; otherwise the
getFileAsync
operation will fail. Use theFile.closeAsync
method to close the file when you are finished working with it.
确保在再次读取文件之前调用 File.closeAsync
- 这可以解释您所看到的问题.
Make sure you call File.closeAsync
before you read the file again - that could explain the issue you are seeing.
更多信息:https://msdn.microsoft.com/en-us/library/office/jj715284.aspx
这篇关于Office.context.document.getFileAsync 抛出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!