Expand Minimize

DocumentBase.WordOpenXML Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

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

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

public string WordOpenXML { get; }

Property Value

Type: System.String
An XML string that contains the contents of the document in the Word Open XML format.

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();
}

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft