Free Support Forum - aspose.com

Mail Merge if statement true value hidden doesn't work


#1

Hello,

We have word documents that we use Aspose Words mailmerge functionality to merge data from our data base. We are in the process of updating to a newer version of Aspose Words (19.4) from 14.5. During this update one thing we noticed was that when we use an if statement test for an empty field on mailmerge and we have the true blank result hidden. It does not evaluate the IF statement at all.

For example in a Word document we have this if statement:

{ if { MERGEFIELD TestFieldValue * MERGEFORMAT } = “” “” “Found Data” * MERGEFORMAT }

and if in Word we highlight the “” true criteria and set the font to hidden. When we run the mailmerge and the field is NOT empty we get no output. If we set the font to not be hidden then the if statement works properly. Also we found that if we have it set to hidden and we add an extra empty un-hidden true clause (below) the if will work fine also.

{ if { MERGEFIELD TestFieldValue * MERGEFORMAT } = “” “” “” “Found Data” * MERGEFORMAT }

I have included a simple example for your consumption. Also, I have included the output file generated with both the New and Old versions.TestForm.zip (4.8 MB)

thanks


#2

@busrider,

We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-18573. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.


#3

Hello,

I was wondering if you have an estimate on when the fix for this will be available? We are in the process of an upgrade and we either need to roll back the newer version or apply a fix.

Thanks


#4

@busrider,

This issue is currently pending for analysis and is in the queue. I am afraid, there is no ETA (time frame) available at the moment. We will inform you via this thread as soon as any estimates or further updates are available. We apologize for your inconvenience.


#5

@busrider,

Regarding WORDSNET-18573, we have completed the work on your issue and concluded to close this issue as ‘Not a Bug’. Please see the following analysis details.

Aspose.Words does not copy hidden text when updating the IF field result like MS Word does. Here is the MS Word Mail Merge output: MS Word output.zip (9.5 KB)

Please share your feedback on this topic. Thanks.


#6

Hello,

Given the example I gave you, Aspose.Words does not only not return the hidden text. It doesn’t even evaluate the if statement. Can you fix the evaluation of the if statement please? In my example, I had data in the field (this should return the “false” criteria of the if statement) but because I have hidden text as the “true” criteria of the if statement it doesn’t do anything. This is the problem. Any help would be appreciated.

thanks


#7

@busrider,

Thanks for the additional information. We will keep you posted here on any further updates.


#8

@busrider,

We have looked into the issue again and here is what we have found.

In this case, Aspose.Words behaves exactly as MS Word does. The true argument is completely marked as hidden (including double quotes) so both MS Word and Aspose.Words’ engines skip the argument completely. That is way, the false argument becomes the only argument for the evaluator and hence is considered a true argument.

I.e. the field is treated as

{ IF 500 = "" "Found Data" \* MERGEFORMAT }

To avoid that, you may remove the hidden attribute from the true argument’s double quotes. That way the IF field will evaluate as expected (still the hidden text in between will be skipped, but this is, again, the natural MS Word’s behavior).