Free Support Forum - aspose.com

Incorrect Aspose Merge Results for REF Fields

Hello,


We recently updated to version 11.10 of Aspose to leverage the new ASK/FILLIN support. It works correctly in some cases but does not in the case of repeating ASK/REF fields. I’ve attached a sample template, expected output and Aspose’s output.

Note that
1. The ASK/REF output is incorrectly duplicated in the Procedure/IOL column
2. One of the values in the Procedure/IOL column correctly increments (xyz0, xyz1, etc.). The other value (which really should be the only one displayed) just repeats xyz9 over and over again incorrectly.

Please advise.

Thank you.

Hi Jeff,


Thanks for your inquiry. ASK field is used to prompt the user for text to assign to a Bookmark and REF field is used to display the text marked by that Bookmark; I have found no Bookmarks in your ‘Template.doc’, could you please confirm if you’ve attached the correct document you’re getting this problem with? Secondly, please attach your complete code here for testing as well. I will investigate the issue on my side and provide you more information.

Best regards,

Are you saying that I need to create a bookmark in the document by hand? ASK should assign to the named bookmark. I shouldn’t need to manually add one.


I am still unclear on how this is related to the problem described.

I cannot provide you with a complete code base (or data source), as it’s integrated with our software. It should be very easy for you to reproduce on your end.

Please let me know if you have any questions.

Thank you.

Hi Jeff,


Thanks for your inquiry and sorry for the confusion. No, you’re not required to add Bookmarks manually in the document. However, unfortunately, it is difficult to say what the problem is without the code. Please supply us with the code from your application that is causing this issue. As soon as you get this piece of code to us we’ll start our investigation into your issue.

Best regards,

I’ve uploaded a simple console application.

Hi Jeff,


Thanks for the additional information. In your case, you can simply skip an extra call to UpdateFields method as MailMerge.Execute method internally calls UpdateFields method and you don’t normally need to explicitly call UpdateFields method right after the execution of MailMerge. I hope, this resolves your problem. Please let me know if I can be of any further assistance.

Best regards,

Did you try this? It doesn’t work.


I commented out the line

document.UpdateFields();

and it still produces the same erroneous result.

Can you please try your suggestion before advising again?

Thank you.

Hi Jeff,


Thanks for your request. Yes, I tested commenting UpdateFields method on my side before suggesting this workaround to you. I have attached the output Word document here for your reference (Please note that this document was produced by using Aspose.Words 11.10.0 and when document.UpdateFields(); statement at Line:29 was commented). Should you have any further questions, please feel free to ask.

Best regards,

Hello,

There must be some kind of serious disconnect in our communication here.

I commented out line 29 as so:

// document.UpdateFields();

Then I re-ran the merge. It generated the attached output. Each "hello" message is duplicated on each line.

It seems like the problem is that your mail merge code is inserting visible bookmarks where the ASK fields were.

Please help me understand why we are not on the same page.

Thank you.

Hi Jeff,


Thanks for your inquiry.
Jeff:
2. One of the values in the Procedure/IOL column correctly increments (xyz0, xyz1, etc.). The other value (which really should be the only one displayed) just repeats xyz9 over and over again incorrectly.
Well, if you don’t comment the UpdateFields statement then the word ‘hello9’ will be repeated ten times where the REF field is located. However, commenting UpdateFields method will correctly update the results of REF fields as ‘hello1’, hello2, hello3’ and so on.
Jeff:
It seems like the problem is that your mail merge code is inserting visible bookmarks where the ASK fields were.
I have logged this issue in our bug tracking system as WORDSNET-7552. Your request has been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Best regards,

Hi Jeff,


I will clarify the situation a little.

The issue which you have mentioned takes place. But its reason is very subtle and is not relative to ASK fields directly. In brief it is all because of MailMergeCleanupOptions.RemoveContainingFields usage in your project. Here is what happens. ASK field retrieves a value and stores it in a bookmark which is located in its result. It is not visible but is persisted. This is MS Word behavior which Aspose.Words mimics as well. But you have MERGEFIELDs inside ASKs and MailMergeCleanupOptions.RemoveContainingFields set. So when a containing field (i.e. ASK) is removed its persisted result becomes visible. We will consider and fix this behavior while implementing WORDSNET-7552. But as a temporary solution you could do not use MailMergeCleanupOptions.RemoveContainingFields if it is acceptable.

I’ve also found that you do not escape double quotes with backslashes inside a single field argument. By this reason you could notice that updating of ASKs in your template leads prompt texts to be truncated to the first double quote occurance using both MS Word and Aspose.Words. You should escape them to give a chance to a processing engine to distinguish an argument boundary and a double quote occurance within an argument.

Regards, Ivan.

The issues you have found earlier (filed as WORDSNET-7552) have been fixed in this .NET update and this Java update.


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