请问如何插入分页符或者分节符

比如模板中有两个标签,第一个标签输入内容后,插入一个分页符或者分节符,使第二个标签的内容显示在新的一页上?

@pechem,

您可以使用以下代码在Word文档中插入页面或分节符。

Document doc = new Document("E:\\temp\\input.docx");
DocumentBuilder builder = new DocumentBuilder(doc);

builder.MoveToDocumentEnd();
builder.InsertBreak(BreakType.PageBreak);
builder.Writeln("Some text");
builder.InsertBreak(BreakType.SectionBreakNewPage);

doc.Save("E:\\temp\\19.2.docx");