Free Support Forum - aspose.com

Using XML and Word Templates to create new invoices

Hello, I am new to Aspose. I am writing a C# application for a business that will give the option of printing invoices after creating/reviewing a transaction. The order details are stored in an xml file containing customer name etc and also multiple products. A sample XML file might look like this:


007
Hire
16/3/2005
1
12/5/2005
Height For Hire
5A Dublin Industrial Estate
John
Keith
3
150.00



50001
Test Product 1
1
50.00
50.00


50002
Test Product 2
1
50.00
50.00


50003
Test Product 3
1
50.00
50.00




Is it possible and if so how to merge this data into a Word template?
Thanks,
Conor


Hi Conor,

Thank you for considering Aspose.

Basically, for merging data into a Word document, you should use the MailMerge class. Its methods accept various kinds of data sources such as DataSource, DataTable, DataView and so on, thus you should load your XML data into those objects and perform the execution of mail merge.

Please search the forums, there is plenty of the code samples for mail merge. Also, look how the Sales Invoice demo project works. The only thing you need to do is to load your data into two data tables: Order and Product.