跳到主要内容

GetAllHeadingParagraphs

从当前文档返回所有标题段落。

语法

expression.GetAllHeadingParagraphs();

expression - 表示 ApiDocument 类的变量。

参数

此方法没有任何参数。

返回值

ApiParagraph[]

示例

此示例展示如何获取文档中的所有标题段落。

// Get all heading paragraphs added to the document.

// How to retrieve all heading paragraphs and make capitalized the first one.

let doc = Api.GetDocument();
let newDocumentStyle = doc.GetStyle("Heading 1");
let paragraph = doc.GetElement(0);
paragraph.SetStyle(newDocumentStyle);
paragraph.AddText("Heading 1");
let headingParagraphs = doc.GetAllHeadingParagraphs();
headingParagraphs[0].SetCaps(true);