Range.Replace Order

Hi

We have an issue with the order which the Range.Replace method is working.AsposeReplaceIssue.zip (270.3 KB)

There is a difference in order between the now deprecated Replace( Regex, iReplacingCallback, bool) which we are using and the current Replace (Regex, string, FindReplaceOptions) which is demonstrated in the attached in the attached solution.

This is the test doc
image.png (22.0 KB)

The old method will process in the order

Tag 1
Tag 2
Tag 3

Whereas the new method
Tag 1
Tag 3
Tag 2

Thanks!

@LNGLEEVFDEV

We are working over your query and will get back to you soon.

@LNGLEEVFDEV,

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

@LNGLEEVFDEV,

Regarding WORDSNET-19357, we have completed the analysis of this issue and concluded that the current version of the Replace method has more correct behavior. We copy the behavior of MS Word here in this case. To reproduce this behavior in MS Word, please follow these steps:

  • Open your document in MS Word
  • Open the Find and Replace window as shown in the image (19357_word_example.zip (47.9 KB))
  • Enter the search text and periodically click the find next button to go to the next found text.

Following the instructions above, you will notice that the text will be found in the following sequence:

  1. tag 1
  2. tag 3
  3. tag 2

The order which the Replace method operates is crucial our solution.

This is a breaking change that has significantly altered existing functionality that it will be costly to replace and rework.

Would it be possible for there to be an option for the current Replace method to process in the same order as the now deprecated Replace method? As it stands, we’re not sure if we can make our solution work without this or at least it would be a major reworking.

@LNGLEEVFDEV,

Thanks for the additional information. We have logged your concerns in our issue tracking system and will keep you posted on any further updates.

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