跳到主要内容

SetType

指定当前节的类型。节类型定义当前节的内容 相对于上一节的放置方式。

语法

expression.SetType(sType);

expression - 表示 ApiSection 类的变量。

参数

名称必需/可选数据类型默认值描述
sType必需SectionBreakType节分隔符类型。

返回值

boolean

示例

此示例将节分隔符类型设置为「continuous」。

// How to update a section type.

// Create a section from a paragraph and make it continuous.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let section = doc.CreateSection(paragraph);
paragraph.AddText("This is section #1 of the document. ");
section = doc.GetFinalSection();
section.SetType("continuous");
paragraph = Api.CreateParagraph();
paragraph.AddText("This is section #2 and we set 'Continuous' type to it. ");
paragraph.AddText("As you can see, the section is not on a new page. ");
paragraph.AddText("If this section had some other type (nextPage, oddPage, evenPage), it would start a new page.");
doc.Push(paragraph);