We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert template docx to Xml file

Hello,
i use Aspose v2.0.50727 and i want to convert a docx template to xml file, i used the folowing code but i have always error (the content is false) :

System.IO.MemoryStream ms= new System.IO.MemoryStream();
Aspose.Words.Saving.XpsOptions options= new Aspose.Words.Saving.XpsOptions();
db.Document.SaveToXps(0,db.Document.PageCount,ms,options);
return ms;

Help please.

Best regards,
Nacata

Hi Nacata,

Thanks for your inquiry. I suggest you please use the latest version of Aspose.Words for .NET 14.5.0.

nacata:
Hello,
i use Aspose v2.0.50727 and i want to convert a docx template to xml file, i used the folowing code but i have always error (the content is false) :

Aspose.Words provides exhaustive
support for different XML-based formats for word processing documents
e.g. OOXML, Flat OPC and also Word 2003 XML. For more details, please
visit the following link:
https://docs.aspose.com/words/net/supported-document-formats/

nacata:
Hello,
System.IO.MemoryStream ms= new System.IO.MemoryStream();
Aspose.Words.Saving.XpsOptions options= new Aspose.Words.Saving.XpsOptions();
db.Document.SaveToXps(0,db.Document.PageCount,ms,options);
return ms;

If you want to save Word document to XPS, please use Document.Save method.

Document doc = new Document(MyDir + "in.docx");
doc.Save(MyDir + "Out.xps", SaveFormat.Xps);

With Aspose.Words, you can load file formats mentioned at following documentation link into Aspose.Words DOM.
https://reference.aspose.com/words/net/aspose.words/loadformat

Once you have loaded a file of LoadFormat into Aspose.Words DOM, you can easily convert it to XPS file format.

Please read following documentation links for your kind reference.
https://docs.aspose.com/words/net/create-or-load-a-document/
https://docs.aspose.com/words/net/save-a-document/