XMLNode.Text Property
Gets or sets the plain unformatted text of the XMLNode control.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)
Syntax
'Declaration
Property Text As String
string Text { get; set; }
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.