Expand Minimize
This topic has not yet been rated - Rate this topic

DocumentBase.Content Property

Gets a Range that represents the main document story.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)
public Range Content { get; }

Property Value

Type: Range
A Range that represents the main document story.

The following code example adds text to the first paragraph in the document and then creates a range that includes all of the content in the document. The code then sets the font size for the contents of the range to 24. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentContent()
{
    this.Paragraphs[1].Range.InsertParagraphAfter();
    this.Paragraphs[1].Range.Text = "This is some sample text.";
    Word.Range myRange = this.Content;
    myRange.Font.Size = 24;
}
Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.