Convert from MS Word to XML


I am trying to convert .doc and .docx format documents into .xml
Please advise if this is possible and how to do this.

I have the below products.

  • aspose.word for .net
  • aspose.pdf for .net
  • for .net


Hi Arvind,

Thank you for contacting support. Aspose.Words API provides exhaustive support for different XML-based formats for word processing documents, e.g. OOXML, Flat OPC and also Word 2003 XML. Please refer to these help topics: WordprocessingML (DOCX, XML) and Converting a Document

Thanks Imran that’s useful information.

Is it possible to generate a sample document using aspose.words into XML format. i can email you a copy of the word document. How is aspose.word ‘save as xml’ different to using built-in ‘save-as feature of msword’.

Hi Arvind,

Thank you for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does.

The FlatOpc saves the document as an Office Open XML WordprocessingML stored in a flat XML file instead of a ZIP package. You can use SaveFormat.WordML to save the document to Microsoft Word 2003 WordprocessingML format.

Please check the following code examples for your kind reference.

Document doc = new Document(MyDir + "in.docx");
doc.Save(MyDir + "Out.xml", SaveFormat.FlatOpc);
Document doc = new Document(MyDir + "in.docx");
doc.Save(MyDir + "Out.xml", SaveFormat.WordML);