مشاركة عبر


XMLNode.NodeText الخاصية

الحصول أو تعيين القيمة نصية XMLNodeعنصر تحكم.

مساحة الاسم:  Microsoft.Office.Tools.Word
التجميع:  Microsoft.Office.Tools.Word (في Microsoft.Office.Tools.Word.dll)

بناء الجملة

'إقرار
Property NodeText As String
    Get
    Set
string NodeText { get; set; }

قيمة الخاصية

النوع: System.String
القيمة نص XMLNodeعنصر تحكم.

ملاحظات

لا يؤدي تعيين القيمة نص "إلى يحذف أية إشارات مرجعية موجودة داخل XMLNodeعنصر تحكم.

أمثلة

يستخدم المثال التعليمات البرمجية التالي NodeTypeخاصية لتحديد ما إذا كان XMLNodeهو على عنصر أو سمة العقدة. إذا XMLNodeهو يستخدم المثال عنصر، NodeTextخاصية لتعيين نص في العنصر. إذا XMLNodeهو يستخدم سمة، المثال NodeValueخاصية لتعيين القيمة السمة. يفترض هذا المثال الذي مستند الحالي يحتوي على XMLNodeباسم CustomerLastNameNode.

Private Sub DisplayNodeDetails()
    If Me.CustomerLastNameNode.NodeType = _
        Word.WdXMLNodeType.wdXMLNodeElement Then
        Me.CustomerLastNameNode.NodeText = "Smith"
        MsgBox("The element '" & Me.CustomerLastNameNode.BaseName & _
            "' has the text '" & Me.CustomerLastNameNode.NodeText & "'.")

    ElseIf Me.CustomerLastNameNode.NodeType = _
        Word.WdXMLNodeType.wdXMLNodeAttribute Then
        Me.CustomerLastNameNode.NodeValue = "Smith"
        MsgBox("The attribute '" & Me.CustomerLastNameNode.BaseName & _
            "' has the value '" & Me.CustomerLastNameNode.NodeValue & "'.")
    End If
End Sub
private void DisplayNodeDetails()
{
    if (this.CustomerLastNameNode.NodeType ==
        Word.WdXMLNodeType.wdXMLNodeElement)
    {
        this.CustomerLastNameNode.NodeText = "Smith";
        MessageBox.Show("The element '" +
            this.CustomerLastNameNode.BaseName + "' has the text '" + 
            this.CustomerLastNameNode.NodeText + "'.");
    }

    else if (this.CustomerLastNameNode.NodeType ==
        Word.WdXMLNodeType.wdXMLNodeAttribute)
    {
        this.CustomerLastNameNode.NodeValue = "Smith";
        MessageBox.Show("The attribute '" +
            this.CustomerLastNameNode.BaseName + "' has the value '" + 
           this.CustomerLastNameNode.NodeValue + "'.");
    }
}

أمن NET Framework.

راجع أيضًَا

المرجع

XMLNode واجهة

XMLNode الأعضاء

Microsoft.Office.Tools.Word مساحة الاسم