Free Support Forum - aspose.com

Problem merging text fields with multiple words using the \* MERGEFORMAT option

Say there is a field { MERGEFIELD lastName \* MERGEFORMAT } in a document. If the field has multiple words like "JOHN KOURANY HAMMESRCHLAG" then result is broken applying two different formats like JOHN KOURANY HAMMERSCHLAG. The first word is OK, the rest of the words don't get the proper format. This was working in API 8, and it is not working well in API 9. Please HELP.

Hi there,

Thanks for your inquiry.

Could you please attach your template here for testing? We will provide you with some further information.

Thanks,

Here is a sample template. I could fix the problem by modifying each an every of our customer’s templates, that would amount to thousends of templates. They all worked fine in version 8 of the API. Hope you can get it to work again in version 9 without having to change the template.

Hi

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

Thank you for additional information. Actually, when you use MERGEFORMAT switch, it is supposed to apply different formatting to the field value if parts of the field has different formatting. Please see the following article to learn more:

http://www.aspose.com/community/blogs/aspose.words-product-family/archive/2010/04/08/toc-update-and-mergeformat-supported-by-aspose-words-for-net-9-0.aspx

If you need that whole field value has the same formatting you should select whole field in your template and set same formatting to whole field. Of just remove MERGEFORMAT switch.

Best regards,

Hi,

A mergefield is a single entity to be replaced with text from some datasource. If that single mergefield is to be replaced with "LOGICWARE SYSTEMS, INC.", how is it that Aspose decides or breaks the text that it is inserting so that the first word logicware shows as LOGICWARE and the rest of the text shows in a different format. Shouldn't all text inserted into a single mergefield have the same properties??? I can forsee that a single field like an IF type of field could include multiple MERGEFIELDS, but I can't see how a particular mergefield when replaced by a string having multiple words can show each word with different properties (color, boldness, etc.).

Hi

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

Thank you for additional information. Aspose.Words mimics MS Word behavior. Have you tried merging your documents using MS Word?

You can easily resolve the problem if make whole field to have same formatting.

Best regards,