【发布时间】:2016-01-18 15:31:48
【问题描述】:
当使用 JavaScript 获取 OOXML 正文 (bodyOOXML.value) 作为字符串使用以下代码时,不包括 word/numbering.xml 包:
Word.run(function (context) {
// Create a proxy object for the document body.
var body = context.document.body;
// Queue a commmand to get the OOXML contents of the body.
var bodyOOXML = body.getOoxml();
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
return context.sync().then(function () {
console.log("Body OOXML contents: " + bodyOOXML.value);
});
})
.catch(function (error) {
console.log("Error: " + JSON.stringify(error));
if (error instanceof OfficeExtension.Error) {
console.log("Debug info: " + JSON.stringify(error.debugInfo));
}
});
word/styles.xml、word/fontTable.xml 等都包含在内,但没有编号包我们无法重新创建编号格式。任何帮助表示赞赏!
【问题讨论】:
-
FWIW 几个月前,我尝试使用 Range.WordOpenXML 更改数字格式,如果将其链接到样式,Word 将不接受我所做的任何事情。当文档在应用程序界面中打开时,MS 确认这是 WordOpenXML 的限制。因此,如果这就是您的想法,那么您的问题可能没有实际意义。
-
杰奎琳,好问题!你能简要解释一下你的情况吗?这是关于获取列表的编号格式吗?仅供参考,在下一波 API 中,我们将提供对列表的编程访问。这包括获取编号列表的编号格式。请告诉我!谢谢!!!胡安。
-
感谢胡安的回复!是的,我们需要访问编号格式以及项目符号列表的项目符号格式。我们还需要能够将列表编号添加到 word/numbering.xml 包中。你认为这个功能也会提供吗?手指交叉:)
标签: javascript ms-office openxml office-js office-2016