Compartilhar via


XMLNode.OwnerDocument Property

Definition

Gets a Document that represents the parent document of the specified XMLNode control.

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

Property Value

A Document object that represents the parent document of the specified XMLNode control.

Examples

The following code example uses the OwnerDocument property to display the name of the owner document of an XMLNode control. This example assumes that the current document contains an XMLNode named CustomerNode.

private void DisplayDocumentName()
{
    Word.Document document1 =
        this.CustomerNode.OwnerDocument;

    MessageBox.Show("The owner document of '" + 
        this.CustomerNode.BaseName + "' is named " + 
        document1.Name);
}
Private Sub DisplayDocumentName()
    Dim document1 As Word.Document = Me.CustomerNode.OwnerDocument
    MsgBox("The owner document of '" & Me.CustomerNode.BaseName & _
        "' is named " & document1.Name)
End Sub

Remarks

The OwnerDocument property returns the same result as the Parent property.

Applies to