Find And Replace in the wrong order

Hello

About the library:
The error occurs with “Aspose-Word for Java”, version 16.3 or 17.3.
It works correctly though with the old version 13.9.0.0, which I used earlier.

Error Description:
When searching and replacing a text placeholder that is present in the document more than once, the placeholders are found and replaced in the wrong order: First, the text placeholders that are placed directly in the document (i.e. in a paragraph), and then the ones wrapped in the table.
I expect the placeholders to be found from top to bottom of the document (it used to work that way earlier).

Effect:
As soon as a customer changes within a report, data from customers is shown mixed.

Steps to reproduction:
I have prepared a simple example with the erroneous scenario: please see the archive file “FindAndReplaceBug.zip”. Comments can be found in the source code.
At startup, input.docx is read and the 5 placeholders found within it are being replaced. The result is saved to output.docx.
Currently I’m using the method “com.aspose.words.Range.replace(Pattern pattern, String replacement, FindReplaceOptions options)”.

Further information:
I used to work with the method “com.aspose.words.Range. replace(Pattern, IReplacingCallback, boolean)” which is deprecated in the current version. Regarding the order (of placeholder processing) it works correctly with the aforementioned method, but sadly another error occurs occasionally when it gets called (please see my older post “java.lang.IllegalStateException: Cannot perform further replacements since the document has been changed.” for more details).
I would be grateful for a swift solution to my problem.

Best regards,
Alexander Lyalin
Eudemonia-Solutions.AG

Hi Alexander,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-15046. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hello Tahir,

I have the following questions because our customers rely on me regarding a solution to the error mentioned above.

Could you please let me know if the bug “WORDSNET-15046” has high priority and in which version I can expect a solution or when you’re planning to fix it approximately?

I would be very pleased if you could answer my questions.
Thank you in advance.

Alexander

The issues you have found earlier (filed as WORDSNET-15046) have been fixed in this Aspose.Words for .NET 17.4 update and this Aspose.Words for Java 17.4 update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Many thanks. Quick adjustment. It works.

best regards
Alexander

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan