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

Free Support Forum - aspose.com

Highlight issues

I have a docx file (attached) with footnotes and need to highlight the character ‘c’ in the text and footnotes.

My java code based on FindAndHighlightText.java:

Document doc = new Document("TestFile.docx");
FindReplaceOptions options = new FindReplaceOptions();
options.ReplacingCallback = new ReplaceEvaluatorFindAndHighlight();
options.setDirection(FindReplaceDirection.BACKWARD);
// We want the "c" character to be highlighted.
Pattern regex = Pattern.compile("c");
doc.getRange().replace(regex, "", options);

// Save the output document.
doc.save("TestFile_out.docx");
//Deprecated replace method
doc.getRange().replace(regex, new ReplaceEvaluatorFindAndHighlight(), false);
doc.save("TestFile_out_deprecated.docx");

When I use deprecated replace method

doc.getRange().replace(regex, new ReplaceEvaluatorFindAndHighlight(), false);

then the character ‘c’ highlighted in the main text and footnotes. But when I use new method

doc.getRange().replace(regex, "", options);

the character ‘c’ highlighted in the main text only.
What the reason of this issue?

I’ve tried this on versions 17.2.0 and 17.4.0.

Hi there,

Thanks for your inquiry. We have tested the scenario and noticed your reported issue, so logged a ticket WORDSNET-15177 in our issue tracking system for further investigation and rectification We will notify you as soon as it is resolved.

We are sorry for the inconvenience.

Best Regards,

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


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