Word Online Office JS - 文本框内的内容控件

时间:2018-04-04 12:52:01

标签: javascript office-js

我们有一些方案,其中文本框用于在正常文本流之外定位内容控件,无论是在文档页眉/页脚还是在正文中。

但是,当我在Word Online上运行时,我们无法对这些内容控件执行操作,因为当我运行以下内容时,文本框中的内容控件不是返回的items数组的一部分:

await Word.run(async (context) => {
    let contentControls = context.document.contentControls;

    contentControls.load();

    await context.sync();

    for (let i = 0; i < contentControls.items.length; i++) {
        let cc = contentControls.items[i];
        // cc will never be the Content Control within the Text Box <- Problem!!
    }

    await context.sync();
});

这适用于Windows上的Word 2016。

是否有其他方法可以加载和操作适用于所有Word主机的所有内容控件?

1 个答案:

答案 0 :(得分:0)

这是设计的,因为Word Online不支持TextBox,也不支持其中的所有内容。正如您所看到的,TextBox在网上呈现为图片,我们无法解析和操纵其中的内容。