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?

Thanks,

Pamela

Hi
Thanks for your request. Aspose.Words fully supports reading and writing WordprocessingML documents. See the following link for more information.
https://docs.aspose.com/words/net/supported-document-formats/
You can open WML template using the following code

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

Or

Document doc = new Document(stream)

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

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

Or

doc.Save(stream, SaveFormat.WordML)

Best regards.