如何使用office.js查找word文档中是否存在strikeThrough /下划线

问题描述

我正在使用office.js进行Word入网。

我有一个要求,例如如果用户在文档中进行了“ strikeThrough”或“ Underline”操作,则将文档加载到word上时。无论是否为True / False,都需要检索该值。

到目前为止,我可以检索当前选择的值。但是在这里,我需要整个文档中的值

示例:-可能是一个字母/一个单词。基本上,它应该通过搜索整个文档(无页数)来返回结果。

Word.run(function (context) {
            var range = context.document.body;
            range.load('font');
            return context.sync()
                .then(function () {
                    console.log("Font: " + range.font.strikeThrough);
                    console.log("Size: " + range.font.size);

                });
        });

因此,尽管在Word上加载的总文档中将单词标记为“ strikeThrough”,但该值始终显示为“ false”。

有人可以帮我吗?

解决方法

使用search method in the Word.Body object

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...