DocumentBuilderDocument Property

Gets or sets the Document object that this object is attached to.

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


public Document Document { get; set; }

Property Value

Type: Document


Shows how to insert sections using DocumentBuilder, specify page setup for a section and reset page setup to defaults.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// 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.Writeln("Section 2, back to default Letter paper size, portrait orientation and top alignment.");

doc.Save(ArtifactsDir + "PageSetup.ClearFormatting.docx");

See Also