Mail Merge Problem for Data with carraige return



I am using the latest Aspose.Word version for mail merge. We now need to support mail merge where the merge field value has carraige return. In the current implementation, all data(text) after the carraige return is stripped by Aspose. Kindly let us how this can be achieved ?

Below the sample code used;

Aspose.Words.Document objWordDocument = new Aspose.Words.Document(_strTemplateFile);


//Step:4 Execute mail merge and save the doc in the extract path . DSEntity.Tables[0] has the data for the mail merge





That is strange. The following test:

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

builder.InsertField(@"MERGEFIELD Name \* MERGEFORMAT", "┬źName┬╗");

doc.MailMerge.Execute(new string[] {"Name"}, new object[] {"John\r\nFoster\r\nDavis"});

string filename = Application.StartupPath + @"\testMergeWithCrlf Out.doc";



shows that mail merge handles data with carriage returns correctly.

Try to provide more info illustrating the problem. Template document, document after mailmerge, actual mailmerge data - all this would be helpful. It would be ideal if you make a small test project, reproducing the problem, and attach it here.

Best regards,


Hi miklovan,

We save the data in the database and retrive the same and print the data. Please try saving the data to the database and find the same.

1. Get the data from the database as an xml, do xsl transformation into a xml.

2. This xml is converted into a dataset and the same is applied for the mail merge.

Will this help you in solving the problem.

Please get back on this.


Can you send me the xml that you convert into the dataset? It could help me to reproduce the problem.



I have figured out the problem is with xsl transformation and we have rectified the problem. Its works fine.Smile [:)]