We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error updateFields if the comparison value of the if query consists of a digit, letter and -wildcard

Hello,

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.

Summary:
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).

More Details:

  1. 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

  1. 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

  1. 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

  1. 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!

Best regards,
Alexander Rosenberg
Eudemonia Solutions AG (On behalf of BMS Consulting GmbH)

@Alex-Reporter Thank you for reporting this problem to us. For a sake of correction it has been logged as WORDSNET-23980. We will keep you updated and let you know once it is resolved or we have more information for you.

The issues you have found earlier (filed as WORDSNET-23980) have been fixed in this Aspose.Words for Java 22.7 update also available on Maven.

Thank you very much. Works correctly.

1 Like