Udostępnij za pośrednictwem


XMLNode.Text Property (2007 System)

Gets or sets the plain unformatted text of the XMLNode control.

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

Syntax

'Declaration
Public Property Text As String
'Usage
Dim instance As XMLNode 
Dim value As String 

value = instance.Text

instance.Text = value
public string Text { get; set; }
public:
property String^ Text {
    String^ get ();
    void set (String^ value);
}
public function get Text () : String 
public function set Text (value : String)

Property Value

Type: System.String
The plain unformatted text of the XMLNode control.

Remarks

Setting this property replaces all of the text inside the XMLNode, including any child nodes.

This property is read-only during design time. It can only be set during run time.

Examples

The following code example displays the number of child nodes in an XMLNode, replaces the text inside the XMLNode by using the Text property, and then displays the number of child nodes again. After setting the Text property, the number of child nodes is zero. This example assumes that the current document contains an XMLNode named CustomerNode.

Private Sub SetTextInParentNode()
    MsgBox("'" & Me.CustomerNode.BaseName & "' has " & _
        Me.CustomerNode.ChildNodes.Count & " child nodes.")
    Me.CustomerNode.Text = "Jones"
    MsgBox("'" & Me.CustomerNode.BaseName & "' now has " _
        & Me.CustomerNode.ChildNodes.Count & " child nodes.")
End Sub
private void SetTextInParentNode()
{
    MessageBox.Show("'" + this.CustomerNode.BaseName + "' has " +
        this.CustomerNode.ChildNodes.Count + " child nodes.");

    this.CustomerNode.Text = "Jones";

    MessageBox.Show("'" + this.CustomerNode.BaseName + "' now has " +
        this.CustomerNode.ChildNodes.Count + " child nodes.");
}

.NET Framework Security

See Also

Reference

XMLNode Class

XMLNode Members

Microsoft.Office.Tools.Word Namespace