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

Free Support Forum - aspose.com

Confirmation on Feature Before Purchase

Currently we have an .NET web application that write to Word generated XML files containing fields. The major issue with this is the concatenation of multiple templates into a single Word compatible (.doc) file.

Example: Database query generates 20 rows with X number of fields to be passed into 3 different .DOC template files and generate 1 new .DOC file, with appropriate page breaks, headings, footers, etc.

Is this possible with Aspose.Words and with templates and queries already created is there an estimate programming time to see a rough example?


Thanks for your inquiry. Yes, I think that you can achieve this using Aspose.Words. For example see the following code. Also see attachment.

DataTable table = new DataTable();
DataRow row = table.NewRow();
row[0] = "test1";
row[1] = "test2";
row[2] = "test3";
// open templates
Document doc1 = new Document(@"367_103139_runtoofar\in1.doc");
Document doc2 = new Document(@"367_103139_runtoofar\in2.doc");
Document doc3 = new Document(@"367_103139_runtoofar\in3.doc");
// execute mail merge
// merge documents
foreach (Section sect in doc2.Sections)
    doc1.Sections.Add(doc1.ImportNode(sect, true, ImportFormatMode.KeepSourceFormatting));
foreach (Section sect in doc3.Sections)
    doc1.Sections.Add(doc1.ImportNode(sect, true, ImportFormatMode.KeepSourceFormatting));
// save document

I hope that this will help you.
Please let me know if you would like to know something else.
Best regards.