Issue with value being changed upon mailmerge

I have an issue where i use the following code…

oWordDoc.MailMerge.RemoveEmptyParagraphs = True
oWordDoc.MailMerge.Execute(strFieldNames, strValues)

Where one of the strValues is “001”. In 6.6 after the mail merge the document showed “001”. Now with 7.0.0 it shows “1”. This is a critical issue… please let me know. Otherwise I am going to have to roll back to version 6.6.
Thanks,
Ronnie

Same problem here !

I give string value to the mail merge and i get these value converted into number by aspose.word.

Example i give a value ((decimal) 5.1).ToString(“N2”), => I should get 5.10 in the word document.

But instead i get a 5.1 value.
Thanks for your help

Hi Ronnie,

rmoorehead:
Where one of the strValues is “001”. In 6.6 after the mail merge the document showed “001”. Now with 7.0.0 it shows “1”. This is a critical issue… please let me know. Otherwise I am going to have to roll back to version 6.6.

Well, it looks like the old code looked at the data type of the value that you pass into mail merge and did not attempt to parse strings into number or datetime. But the new code executes mail merge using the generic field update procedure and this attempts to parse strings into numbers because field values in a document are always strings.
We will most likely have to revert to the old behavior, but I just want to check with your maybe it will be more appropriate for you to modify the template document and add a number formatting switch to ensure it will output the field using three digits? I mean adding the “# 000” switch to the merge field.

Hi soho,

*soho:

I give string value to the mail merge and i get these value converted into number by aspose.word.

Example i give a value ((decimal) 5.1).ToString(“N2”), => I should get 5.10 in the word document.

But instead i get a 5.1 value.
Thanks for your help*

Sorry I do not understand your example. Can you take me slowly step by step through it. This thread is about a case where a string value is passed into a mail merge and it is parsed to a number and then formatted to a string again using default format. This makes the string “001” goes to “1”, whereas it should have stayed as “001”.

i have a decimal value that i convert to a string to get exactly two digit after the decimal mark.

for exemple i have 4.5054458 and i convert that to a string “4.50”, so it’s not anymore a number but a string (the ToString method do that)

When i pass my string “4.50” to the mailmerge i get a result value: “4.5”, That’s odd because i didn’t pass a number but a string and no formatting should occur.

You must check the typeof the object of the mailmerge before doing some sort of formatting, and if there is a string don’t try to parse it into a number or something else.

As response to the question, “Can I reformat my documents?” I don’t think that is a good idea. All of our processing/formatting of the data is done in the program and I don’t want to have to worry about having to find all of those now. I am open to the idea of a setting to change the behavior, so thay we can this turn behavior on/off.

Thanks,
Ronnie

Hi

Thank you for additional information. This thread has been linked to the appropriate issue. You will be notified once the problem is resolved.
Best regards.

Also getting the same issue. Phone numbers are being altered after MailMerge is used. For example test case ‘01234567890123456789’ is being changed to ‘1234567890123460000’.

Hi

Thanks for your request. The original issue is already resolved in the current codebase. The fix will be included into the next hotfix, which will be released within the week. You will be notified.
Also, could you please attach your document and code here for testing?
Best regards,

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

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

have a similar problem with mailmerge formatting { MERGEFIELD AMOUNT # $,#0.00;$,#0.00);$0.00”}
This formatting is used for many templates more than 100. I am working on replacing the word application interop with aspose mailmerge and I do not want to change all the templates
Amount = 1980.09
expected value = $(1,980.09)
Current Result = $1,9(80.09)

Please provide me a solution that does not involve the template changes because I have more than 100 templates that have this custom formatting and for some it works and for some it doesn’t.

@Ajisha The question is already answered here:
https://forum.aspose.com/t/mergefield-number-formatting/280264/3