MergeEvent properties are incorrect


#1

I have been using a merge event handler to handle certain types of merge field when the merge is executed but I have noticed thats some of the properties of the mergeFieldEvent object never contain the values I would expect to find.

MergeFieldHandler works fine 90% of the time, but it behaves incorrectly when I execute more then one mail merge on the same document object. It processes the merge fields fine the first time around, but when I goto execute the second mail merge the E.fieldValue always equals 'Nothing'. Although I can quite clearly see in the datatable that there is data there.

Can anyone help me with this?


#2

Hi,

I'll be happy to investigate what's going on, but please do the following. Either post your code here (surely specify what data the DataTable contains if it's possible to simulate it programmatically, without involving the database) and attach the template or just attach a small sample project that fails.


#3

Apologies it appears I have some what mis-diagnosed my problem and it is slightly differant from how I have stated it.

I have a document object with a mergeEventHandler attached that I use to handle certain fields in the document. Whilst this document is open I execute X amount of mail merges (in this case 5) to generate the document. After the first two mail merges I attach the handler (As this is the only place where it is required) then merge the remainder of the document.

The problem is when I come to execute the third merge It just doesnt execute. In debug mode in visual studio the statement cursor just 'hops' over it. I can set watches on the data_table iam trying to merge and it contains the data I would expect to find in the appropriately name columns (IE the same as the merge field in the document).

If I save the document before I perform the third mailmerge there are the correct merge fields in the document. Do you have any idea as to why this is happening?


#4

Hard to say at once. Please attach the things I requested to enable us to replicate the issue.


#5

Apologies again, I have now resolved my issue and it was a logical problem with my code not a bug or problem with aspose.word, I misunderstood how mergeEventHandler dealt with mergefields and datasets , but thank you for your help and support with this matter, it has been most impressive,

Regards and Thanks Michael