Document Properties (2007 ...


Visual Studio Tools for Office API Reference
Document..::.Content Property (2007 System)

Gets a Range that represents the main document story.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)
Syntax

Visual Basic (Declaration)
<BrowsableAttribute(False)> _
Public ReadOnly Property Content As Range
Visual Basic (Usage)
Dim instance As Document
Dim value As Range

value = instance.Content
C#
[BrowsableAttribute(false)]
public Range Content { get; }

Property Value

Type: Microsoft.Office.Interop.Word..::.Range
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.

This example is for a document-level customization.

Visual Basic
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
C#
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;
}
Permissions

See Also

Reference

Tags :


Page view tracker