Free Support Forum - aspose.com

Different merge line break behavior in newer versions

We recently upgraded from version 4.4 to 8.0 to take advantage of PDF conversion. However, we’ve run into an issue in how line breaks are generated in the newer version. Previously, if we had a string of merge fields like this:
<span style=“font-size: 12pt; font-family: “Times New Roman”,“serif”;”>«Preferred_Address_Address_1»<span style=“font-size: 12pt; font-family: “Times New Roman”,“serif”;”>«Preferred_Address_Address_2»<span style=“font-size: 12pt; font-family: “Times New Roman”,“serif”;”>«Preferred_Address_Address_3»
it would produce line breaks after each code if and only if there was a value for each of the fields. So address line 2 would appear on its own line if it has a value, but if it’s blank, we would not see an empty line. However, upon upgrading we now see these fields appearing on the same line. I know we can add a field switch to do a conditional line break, but this is a big inconvenience for us because we have many templates deployed to our clients that would require modification. Is there any way to keep the old line break behavior? I’ve attached a sample report that behaves differently depending on the version of Aspose.Words used.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Could you please reattach your template? It seems the document was corrupted for some reason, I can open it in MS Word, but it seems it layout was broken.

Also, please attach a sample code and output documents, produced using old and new versions. I will check the issue and provide you more information.

Best regards.

I’ve attached a simpler version of the template plus merged results with the only difference being the Aspose.Words assembly version (4.4 or 8.0). We merge to a DataTable like so:
Aspose.Words.Document Template = new Aspose.Words.Document(strFilePath);
Template.MailMerge.Execute(dtMemberData);
Template.MailMerge.DeleteFields();
MemoryStream ms = new MemoryStream();
Template.Save(ms, Aspose.Words.SaveFormat.Doc);
byte[] arrBytes = ms.ToArray();
ms.Close();

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed.

Best regards.

The issues you have found earlier (filed as 11154) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(61)