Using IFieldMergingCallback & Updating C# Code of Merge Field Event Handler | Migrate 10.3 to 20.4 Version

Hello all,

I have a project that uses very old aspose librarys for word and pdf (version 9.3 and 10.3). We have purchased a new license and are in the process of migrating over to version 20.4. However, we are having some difficulty in transitioning from MergeFieldEventHandler(HandleMergeField) to the ifieldmergingcallback method. I have read over the migration guide and applied it to our extensive code, but we are having problems with variables being inaccessible or lost in the process. When the mailmerge.execute runs, it seems to clear out the variables being used by the fieldmergingcallback. Is there a workaround for this? Thanks

@taltal045,

To ensure a timely and accurate response, please ZIP and attach the following resources here for testing:

  • Your simplified input Word document
  • Please create a standalone simple runnable Console Application (source code without compilation errors) that produces the correct output when running with old 10.3 version of Aspose.Words and attach it here for testing. Please do not include Aspose.Words DLL files in it to reduce the file size.

As soon as you get these pieces of information ready, we will start investigation into your scenario / use-case and provide you updated code which will produce the same output when running with the latest 20.4 version of Aspose.Words. Thanks for your cooperation.

I can provide the template word doc and code before/after the updates made, but I cannot provide a standalone application due to complexity and security concerns.

@taltal045,

Please extract only the relevant part of source code (that you want to migrate) from your main application into a new runnable Console Application. We will then provide you updated code. Thanks for your cooperation.

After speaking with my time, it would take far too long to try and create a console app version of our service just for this purpose. Would it be possible to have a debug version of Aspose.words that can help us debug what is breaking in the ExecuteWithRegions process? Its not a consistent failure, only some ExecuteWithRegions causes the variables to clear out and break the application.

@taltal045,

We are checking this scenario and will get back to you soon.

@taltal045,

We have discussed the matter with our team but I am afraid, it is not possible for us to provide you with a debug version of Aspose.words API. Also, it is difficult to say what the exact problem is without the source document and code (console app). We need these resources to be able to reproduce the problem on our end. Thanks for your cooperation.