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

Free Support Forum - aspose.com

How to Use Word XML Template in Generated Document

Currently we are using a Word Document for the input to Aspose.Words but want to store the template into the application resources. Since a Word Template would be stored as a Binary file, we began to explore storing it as an Word XML file.

Our test was performed without storing the XML into the resources - we first want to ascertain if the XML option is viable for the Aspose.Words.

Can you provide a code sample for that shows how we should be implementing this approach when using XML in a resource to generate a Word document?


Pamela :slight_smile:


Thanks for your request. Aspose.Words fully supports reading and writing WordprocessingML documents. See the following link for more information.


You can open WML template using the following code

Document doc = new Document("in.xml")


Document doc = new Document(stream)

You should use the following code to save document in WML format.

doc.Save("out.xml", SaveFormat.WordML)


doc.Save(stream, SaveFormat.WordML)

Best regards.