ParagraphBreakIsStyleSeparator Property

True if this paragraph break is a Style Separator. A style separator allows one paragraph to consist of parts that have different paragraph styles.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.10.0


public bool BreakIsStyleSeparator { get; }

Property Value

Type: Boolean


Shows how to write text to the same line as a TOC heading and have it not show up in the TOC.
// Create a blank document and insert a table of contents field
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertTableOfContents("\\o \\h \\z \\u");

// Insert a paragraph with a style that will be picked up as an entry in the TOC
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;

// Both these strings are on the same line and same paragraph and will therefore show up on the same TOC entry
builder.Write("Heading 1. ");
builder.Write("Will appear in the TOC. ");

// Any text on a new line that does not have a heading style will not register as a TOC entry
// If we insert a style separator, we can write more text on the same line
// and use a different style without it showing up in the TOC
// If we use a heading type style afterwards, we can draw two TOC entries from one line of document text
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Quote;
builder.Write("Won't appear in the TOC. ");

// This flag is set to true for such paragraphs

// Update the TOC and save the document
doc.Save(ArtifactsDir + "Paragraph.BreakIsStyleSeparator.docx");

ExpandedSee Also