簡體   English   中英

是否可以搜索Word文檔並返回所有表?

[英]Is it possible to search a Word document and return all the tables?

當用戶單擊按鈕時,我想遍歷Word文檔中的所有表,並將這些表的樣式更改為預定義的樣式。

這可能嗎?

Word.run(function(context) {
        var body = context.document.body;

        context.load(body, 'table');

        //iterate through tables

        return context.sync();
});

要迭代的數組是

context.document.body.tables.items

但是您需要先加載表並進行同步,然后才能遍歷tables.items數組。 在循環中,您可以設置各種style *屬性,字體等。有關詳細信息,請參見Table

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM