Click or drag to resize

BreakType Enumeration

Specifies type of a break inside a document.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public enum BreakType
Members
  Member nameValueDescription
ParagraphBreak0 Break between paragraphs.
PageBreak1 Explicit page break.
ColumnBreak2 Explicit column break.
SectionBreakContinuous3 Specifies start of new section on the same page as the previous section.
SectionBreakNewColumn4 Specifies start of new section in the new column.
SectionBreakNewPage5 Specifies start of new section on a new page.
SectionBreakEvenPage6 Specifies start of new section on a new even page.
SectionBreakOddPage7 Specifies start of new section on a odd page.
LineBreak8 Explicit line break.
Examples
Shows how to insert sections using DocumentBuilder, specify page setup for a section and reset page setup to defaults.
DocumentBuilder builder = new DocumentBuilder();

// Modify the first section in the document
builder.PageSetup.Orientation = Orientation.Landscape;
builder.PageSetup.VerticalAlignment = PageVerticalAlignment.Center;
builder.Writeln("Section 1, landscape oriented and text vertically centered.");

// Start a new section and reset its formatting to defaults
builder.InsertBreak(BreakType.SectionBreakNewPage);
builder.PageSetup.ClearFormatting();
builder.Writeln("Section 2, back to default Letter paper size, portrait orientation and top alignment.");

builder.Document.Save(ArtifactsDir + "PageSetup.ClearFormatting.doc");
Examples
Creates headers and footers in a document using DocumentBuilder.
// Create a blank document
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Specify that we want headers and footers different for first, even and odd pages
builder.PageSetup.DifferentFirstPageHeaderFooter = true;
builder.PageSetup.OddAndEvenPagesHeaderFooter = true;

// Create the headers
builder.MoveToHeaderFooter(HeaderFooterType.HeaderFirst);
builder.Write("Header First");
builder.MoveToHeaderFooter(HeaderFooterType.HeaderEven);
builder.Write("Header Even");
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
builder.Write("Header Odd");

// Create three pages in the document
builder.MoveToSection(0);
builder.Writeln("Page1");
builder.InsertBreak(BreakType.PageBreak);
builder.Writeln("Page2");
builder.InsertBreak(BreakType.PageBreak);
builder.Writeln("Page3");

doc.Save(ArtifactsDir + "DocumentBuilder.HeadersAndFooters.doc");
Examples
Demonstrates how to insert a Table of contents (TOC) into a document using heading styles as entries.
// Use a blank document
Document doc = new Document();
// Create a document builder to insert content with into document
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert a table of contents at the beginning of the document
builder.InsertTableOfContents("\\o \"1-3\" \\h \\z \\u");
// Start the actual document content on the second page
builder.InsertBreak(BreakType.PageBreak);
// Build a document with complex structure by applying different heading styles thus creating TOC entries
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;

builder.Writeln("Heading 1");

builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading2;

builder.Writeln("Heading 1.1");
builder.Writeln("Heading 1.2");

builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;

builder.Writeln("Heading 2");
builder.Writeln("Heading 3");

builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading2;

builder.Writeln("Heading 3.1");

builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading3;

builder.Writeln("Heading 3.1.1");
builder.Writeln("Heading 3.1.2");
builder.Writeln("Heading 3.1.3");

builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading2;

builder.Writeln("Heading 3.2");
builder.Writeln("Heading 3.3");

// Call the method below to update the TOC
doc.UpdateFields();
See Also