【发布时间】:2018-03-21 03:45:18
【问题描述】:
我正在尝试读取标头 ooxml,对其进行修改并插入回标头。但是在插入时,它以某种方式在标题中添加了额外的一行。即使我只是阅读了 ooxml 并将其插入而没有任何更改,它也会在标题中添加一个额外的行。我错过了什么?
这是我的代码
Word.run(function (context) {
var docSections = context.document.sections;
context.load(docSections, 'body/style');
return context.sync().then(function () {
// get header
var header = docSections.items[0].getHeader("primary");
var ooxml = header.getOoxml();
// another sync to get the OOXML value
return context.sync().then(function () {
// get ooxml value and insert it
var headerVal = ooxml.value;
header.insertOoxml(headerVal, 'Replace');
return context.sync().then(function () {
callBackFunc({
isError: false
});
});
});
});
})
【问题讨论】:
-
能否请您提供您在哪个平台和版本中观察这个?谢谢!!
-
Windows 7、Word 2016 (16.0.4639.1000)、API 1.1
-
刚刚在下面回答