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

Free Support Forum - aspose.com

How to save all merged info in one document

I want to save all the data that has been merged in one document rather than saving it in separate documents. Below is the code of how it currently save each DataRow that has been merged into a separate document.

// Loop though all records in the data source.
foreach (DataRow row in data.Rows)
// Execute mail merge.

// Save the document.
doc.Save(string.Format(@“c:_Employees\Output\Employee_{0}.docx”, counter++));

Currently the save method is within the loop, but how do I add that info the a document and save it as a whole when the loop is finished?

Hi Johnane,

Thanks for your inquiry. You can save individual documents into individual streams in memory and then join all individual documents from streams onto a single Document and then save it on disk. Hope, this helps.

Saving to a Stream
Joining and Appending Documents

Best regards,

Thank You very much

That information you provided solved the problem

Great Work