环境:Mac Office 2016 build 15.26
我正在阅读Word文档' Office.initialize完成后的CustomXmlParts。我使用的是Office.context.document.customXmlParts.getByNamespaceAsync API。 getByNamespaceAsync间歇性地卡住。只要我单击Word文档,API就会恢复并成功读取CustomXmlParts。
围绕这个做什么工作?我也尝试调用context.document.getSelection来模仿光标点击,但没有帮助。
Office.context.document.customXmlParts.getByNamespaceAsync("MyXmlTag", function (asyncResult) {
if (asyncResult.value.length > 0) {
asyncResult.value[0].getNodesAsync("/", function (asyncNodeResult) {
if (asyncNodeResult.status == Office.AsyncResultStatus.Failed) {
console.log(" Failed to read word document. " + JSON.stringify(asyncResult));
} else {
asyncNodeResult.value[0].getNodeValueAsync(function (result) {
if (result.status == Office.AsyncResultStatus.Failed) {
console.log(" getNodeValueAsync: Failed " + JSON.stringify(asyncResult));
}
else {
//result.valuse is xml data
}
});
}
});
}
else {
console.log(" CustomXML part is not found");
}
});
`
答案 0 :(得分:0)
感谢您报告此问题。我还没有能够在内部重现它。一些问题: