다음을 통해 공유


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 속성을 사용하여 특성 값을 설정합니다. 이 예제에서는 현재 문서에 CustomerLastNameNode라는 XMLNode가 포함되어 있다고 가정합니다.

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 인터페이스

Microsoft.Office.Tools.Word 네임스페이스