Free Support Forum - aspose.com

Unicode text from Source does not show up in merged document

I read in both a Word Document (contains english and simplified chinese) and a CSV Document (contains both english and simplified chinese).

I load the CSV intoa DataTable and WordDoc into a Document. Perform a merge, and the resultant Word Document's merged fields contain the english but not the simplified chinese.

Example Merge source line: 簡體字fname字,lname,125324252,Rex

the first field shows as : fname

The original simplified chinese in the word document remains unchanged as expected.

Hi,

Thank you for interest in Aspose.Word.

I tested mail merge using your source line and that worked perfect. Please make sure:

1) You use the latest version of Aspose.Word

2) The DataTable object you pass to the merge execution method does contain those Chinese characters.

Also, try to add the source line you specified to the DataTable directly in your code and see if it works. If nothing helps, please attach your template and post a piece of your code that performs the merge.

I further investigated the problem. The merge is
properly taking the the DataTable and merging it into the Word
document. (saved merged doc to local, and unicode is there). My
next steps after the merge is the following code segment:



// Merge MS Word Document with Merge Source Document

wordDoc.MailMerge.Execute(myTable);



wordDoc.Save(“C:\MSMailMerge\word.doc”);

// Save the document in Aspose.PDf.XML format into a memory stream

MemoryStream memstPDF = new MemoryStream();

wordDoc.Save(memstPDF, SaveFormat.FormatAsposePdf);



// Seek to the beginning so it can be read by XMLDocument

memstPDF.Seek(0, SeekOrigin.Begin);



// Load the document into an XMLDocument

XmlDocument xmlDoc = new XmlDocument();

xmlDoc.Load(memstPDF);



//Read the document in Aspose.Pdf.Xml format into Aspose.Pdf.

Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();

pdf.IsImagesInXmlDeleteNeeded = true;

pdf.BindXML(xmlDoc, null);



// Return PDF as Byte[]

return pdf.GetBuffer();



The resultant PDF does not contain the unicode from the merged
fields, but it does contain the unicode that was originally in the word
document (text after Good Luck.). The unicode text in the merged fields
does not make it, yet the english text does. See attachment for
PDF.



Thanks


BTW: dubboy and dgomes are one and the same, i forgot my user id and email that i had used when i first registered.



I am using Aspose.Pdf 2.6.2.0 and Aspose.Word 3.2.2.0.



I am also attaching the generated Word document, that inturn is transformed to XML then to PDF.




Just updated to Aspose.PDF 6.2.3.0 and still, same issues exist.