Skip to content

Instantly share code, notes, and snippets.

@aspose-words-gists
Created January 21, 2025 09:01
Show Gist options
  • Save aspose-words-gists/ecf2c438314e6c8318ca9833c7f62326 to your computer and use it in GitHub Desktop.
Save aspose-words-gists/ecf2c438314e6c8318ca9833c7f62326 to your computer and use it in GitHub Desktop.
Aspose.Words for .NET. Document builder overview using C#.
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Font font = builder.Font;
font.Size = 16;
font.Bold = true;
font.Color = Color.Blue;
font.Name = "Arial";
font.Underline = Underline.Dash;
ParagraphFormat paragraphFormat = builder.ParagraphFormat;
paragraphFormat.FirstLineIndent = 8;
paragraphFormat.Alignment = ParagraphAlignment.Justify;
paragraphFormat.KeepTogether = true;
builder.Writeln("A whole paragraph.");
doc.Save(ArtifactsDir + "AddContentUsingDocumentBuilder.InsertParagraph.docx");
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git.
Document doc = new Document(MyDir + "Bookmarks.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("MyBookmark1", false, true);
builder.Writeln("This is a bookmark.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment