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

Free Support Forum - aspose.com

IF Comparison with formatted numbers validates wrong

Error Description:

The error occurs in version 22.7 of Aspose Word for Java. In our current version 13.9.0 we have no problems.

• In our customers report there is a bookmark called “Anwendungsgrenze” which is set to value 1 computed before. Additionally it is formatted with the number format “#.###,0”.
{Set Anwendungsgrenze {=1 \# #.###,0}}
• Later on the bookmark is referenced within an If-Formula and compared to 1.
{If {Ref Anwendungsgrenze \*CHARFORMAT \*MERGEFORMAT} = 1 “1“ “0“}
• Expected Result: 1
• Actual Result: 0

• All fields and formulas are preconfigured in MS Word and are not generated by our code.
• Updating all fields by F9 helps and is a possible temporary workaround for generating Word Documents, but not for the generation of PDF documents.
• Changing the number format in the set Statement to “#,0” fixes the problem, so we assume that the bug has something to do with the format and the problem is not in the computations before.

Unfortunately I do not know exactly how to reconstruct the problem because I’m very new to Aspose. I have prepared a simple example which shows the important section of our customers report, so you can generate and debug the document yourself. The input document is “Testdokument.docx” and the output will be saved to “Output_Textdokument.docx”. ComparisonErrorWithFormattedNumber.zip (42.7 KB)

Did I miss something? Do not hesitate to ask me if you need more information.
I would be very glad for a fast solution. Thank you in advance!

Best regards,
Carlo Rissmöller
Eudemonia Solutions AG

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

You have written that it is logged as WORDSNET-24372 but it is a problem in Aspose for Java.

@Carlo_Eudemonia Yes, I have noticed that you are using Java version. Aspose.Words for .NET is the main product. All fixes made in .NET version are automatically ported to Java, C++ and Python version.

Okay, thx for the information! Good to know!

1 Like