Mail Merge Problem for Data with carraige return


#1

Hi,

I am using the latest Aspose.Word version 3.6.1.0 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);

objWordDocument.MailMerge.UseNonMergeFields=true;

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

objWordDocument.MailMerge.Execute(DSEntity.Tables[0]);

objWordDocument.Save(_strExtractedFileName);

Thanks...


#2

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";

doc.Save(filename);

System.Diagnostics.Process.Start(filename);

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,


#3

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.


#4

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


#5

Hi,

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

Thanks