Freigeben über


DocumentBase.WordOpenXML Property

Definition

Gets an XML string that contains the contents of the document in the Word Open XML format.

public:
 property System::String ^ WordOpenXML { System::String ^ get(); };
public string WordOpenXML { get; }
member this.WordOpenXML : string
Public ReadOnly Property WordOpenXML As String

Property Value

An XML string that contains the contents of the document in the Word Open XML format.

Examples

The following code example retrieves the Open XML content of the current document and saves this XML content into a file in the current directory. To use this example, run it from the ThisDocument class in a document-level project.

private void GetXMLContent()
{            
    // Get XML content
    string XMLContent = this.WordOpenXML;
    // Save XML content into a file in the current directory
    System.IO.StreamWriter sw = 
        System.IO.File.CreateText(@"myXMLDoc.xml");
    sw.Write(XMLContent);
    sw.Close();
}
Private Sub GetXMLContent()
    ' Get XML content
    Dim XMLContent As String = Me.WordOpenXML
    ' Save XML content into a file in the current directory
    Dim sw As System.IO.StreamWriter = _
        System.IO.File.CreateText("myXMLDoc.xml")
    sw.Write(XMLContent)
    sw.Close()
End Sub

Applies to