Error Description :
Library: The error occurs starting with “Aspose-Word for Java, version 15.5.0 up to the most recent version. I did two samples of older libraries: 15.4.0 and 13.9 (Version with which still runs our old project). Both these older libraries did not contain the error I am about to describe. I also downloaded the newest version (22.05 at the time of writing), which still consists of the bug. Therefore my conclusion is that the bug got introduced in 15.5.0 and was not an issue in the prior versions.
There seems to be a problem with the Aspose method “Document.updateFields()”. If the field contains an if-query with a comparison-value of a digit, a letter and a wildcard(*) .
MS Word itself handles this correctly with a manual update (select everything with CTRL + A and press F9).
- if the comparison value of the if query consists of, a digit and a letter but without * wildcard, then it works correctly
IF ratingvalue = “1c” “correctly” “incorrectly” * MERGEFORMAT
- if the comparison value of the if query consists of only a digit with *-wildcard, then it works correctly
IF ratingvalue1 = “2*” “correctly” “incorrectly” * MERGEFORMAT
- if the comparison value of the if query consists of only a letter with -wildcard, then it works correctly*
IF ratingvalue2 = “a*” “correctly” “incorrectly” * MERGEFORMAT
- if the comparison value of the if query consists of a digit, letter and -wildcard, then update of the fields from the version 15.5.0 works incorrectly*
IF ratingvalue = “1c*” “correctly” “incorrectly” * MERGEFORMAT
For your information – I only reproduced the error with the asterisk as wildcard, it is possible that the same behaviour occurs with other wildcards as well.
Steps to reproduction:
I have prepared a simple example with the erroneous scenario: please see the archive file “errorFieldUpdateByUseIfWithWildcard.zip” errorFieldUpdateByUseIfWithWildcard.zip (69.9 KB)
At the first start input.docx is read and the 3 placeholders it contains are replaced with values. There are also 4 sample fields with IF queries that use the replaced values. The method Documents.UpdateFields() is called, and the result is stored in output.docx.
The last field with the IF query does not work correctly from version 15.5.0.
I would be grateful for a swift solution to my problem. Thank you in advance!
Eudemonia Solutions AG (On behalf of BMS Consulting GmbH)