DocumentBuilderInsertStyleSeparator Method
Inserts style separator into the document.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.10
Syntax
public void InsertStyleSeparator()
Remarks
This method allows to apply different paragraph styles to two different parts of a text line.
Examples
Shows how to separate styles from two different paragraphs used in one logical printed paragraph.
[C#]

DocumentBuilder builder = new DocumentBuilder(new Document());

Style paraStyle = builder.Document.Styles.Add(StyleType.Paragraph, "MyParaStyle");
paraStyle.Font.Bold = false;
paraStyle.Font.Size = 8;
paraStyle.Font.Name = "Arial";

// Append text with "Heading 1" style.
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;
builder.Write("Heading 1");
builder.InsertStyleSeparator();

// Append text with another style.
builder.ParagraphFormat.StyleName = paraStyle.Name;
builder.Write("This is text with some other formatting ");
Examples
Shows how to use and separate multiple styles in a paragraph
[C#]

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.Write("This text is in the default style. ");

builder.InsertStyleSeparator();

// Create a custom style
Style myStyle = builder.Document.Styles.Add(StyleType.Paragraph, "MyStyle");
myStyle.Font.Size = 14;
myStyle.Font.Name = "Courier New";
myStyle.Font.Color = Color.Blue;

// Append text with custom style
builder.ParagraphFormat.StyleName = myStyle.Name;
builder.Write("This is text in the same paragraph but with my custom style.");

doc.Save(ArtifactsDir + "DocumentBuilder.StyleSeparator.docx");
See Also