Partager via


DocumentBase.Content Property

Definition

Gets a Range that represents the main document story.

public:
 property Microsoft::Office::Interop::Word::Range ^ Content { Microsoft::Office::Interop::Word::Range ^ get(); };
public Microsoft.Office.Interop.Word.Range Content { get; }
member this.Content : Microsoft.Office.Interop.Word.Range
Public ReadOnly Property Content As Range

Property Value

A Range that represents the main document story.

Examples

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;
}
Private Sub DocumentContent()
    Me.Paragraphs(1).Range.InsertParagraphAfter()
    Me.Paragraphs(1).Range.Text = "This is some sample text."
    Dim myRange As Word.Range = Me.Content
    myRange.Font.Size = 24
End Sub

Applies to