Document Constructor

Creates a blank Word document.

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

Syntax

public Document()

Remarks

The document paper size is Letter by default. If you want to change page setup, use Section.PageSetup.

After creation, you can use DocumentBuilder to add document content easily.

Examples

Shows how to add a formatted run of text to a document using the object model.
Document doc = new Document();

// Create a new run of text
Run run = new Run(doc, "Hello");

// Specify character formatting for the run of text
Aspose.Words.Font f = run.Font;
f.Name = "Courier New";
f.Size = 36;
f.HighlightColor = Color.Yellow;

// Append the run of text to the end of the first paragraph
// in the body of the first section of the document
doc.FirstSection.Body.FirstParagraph.AppendChild(run);

See Also