共用方式為


XMLNode.Range Property

Definition

Gets a Range object that represents the portion of a document that is contained in the XMLNode control.

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

Property Value

A Range object that represents the portion of a document that is contained in the XMLNode control.

Examples

The following code example uses the Range property to set the font and apply bold formatting to the text in an XMLNode. This example assumes that the current document contains an XMLNode named CustomerLastNameNode.

private void FormatNodeText()
{
    this.CustomerLastNameNode.NodeText = "Smith";
    this.CustomerLastNameNode.Range.Bold = 1;
    this.CustomerLastNameNode.Range.Font.Name = "Arial";
}
Private Sub FormatNodeText()
    Me.CustomerLastNameNode.NodeText = "Smith"
    Me.CustomerLastNameNode.Range.Bold = 1
    Me.CustomerLastNameNode.Range.Font.Name = "Arial"
End Sub

Applies to