Run Constructor (DocumentBase, String)

Initializes a new instance of the Run class.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public Run(
	DocumentBase doc,
	string text
)

Parameters

doc
Type: Aspose.WordsDocumentBase
The owner document.
text
Type: SystemString
The text of the run.
Remarks

When Run is created, it belongs to the specified document, but is not yet part of the document and ParentNode is null.

To append Run to the document use InsertAfter or InsertBefore on the paragraph where you want the run inserted.

Examples
Shows how to add a formatted run of text to a document using the object model.
// Create an empty document. It contains one empty paragraph
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