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

Free Support Forum - aspose.com

Error with IReplacingCallback

Hi


I have just discovered an error in Aspose.Words 13.11+

When using the code from http://www.aspose.com/docs/display/wordsnet/How+to+Find+and+Highlight+Text to search and highlight text, and have a run in which the word you search for is represented multiple times, the code fails.

This works in Aspose.Words 13.10 which is currently used in production, but upon upgrading to Aspose.Words. 14.4 the error appeared.

It seems possible the error stems from the fix to WORDSNET-9180.

If you search and highlight in the existing document for the word “word”, second time the Replacing method is called, the MatchNode is wrong and contains an MatchOffset beyond the limits of the node. Using Aspose.Words 13.10 this works as expected.

In 13.10 it continued from the current Run. In 13.11+ it seems like it finds all Runs up front, so if you modify the runs in the Replacing method it will get messed up.

Let me know if you need any further information to investigate.

Best regards
/Anders


Hi Anders,


Thanks for reporting this problem to us. We have updated the example in this article now. I hope, this helps.

Best regards,

Hi,


It seems correct that reverting the bool does the trick.

I don’t have the time to test it properly today, but just by copying over the sample it seems to work fine.

Best regards
/Anders

Hi Anders,


Please let us know if you have any troubles and we will be glad to look into this further for you.

Best regards,