Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find FindReplaceOptions class #37

Closed
Golenko opened this issue Nov 17, 2016 · 4 comments
Closed

Cannot find FindReplaceOptions class #37

Golenko opened this issue Nov 17, 2016 · 4 comments

Comments

@Golenko
Copy link

Golenko commented Nov 17, 2016

Hello guys,
I'm trying to execute this example

The problem is that classes FindReplaceOptions and FindReplaceDirection are absent from com.aspose.words package.

The version of the jar I use is aspose-words-16.6.0-jdk16.jar

Is that something that expected and example should be updated?

Thanks.

@sohail-aspose
Copy link
Collaborator

Hi Golenko,
Please use the latest version of Aspose.Words for Java 16.11.0.

I have tested ReplaceWithString example and it is running perfectly fine. I used this file as input and it produces this file as output.

@Golenko
Copy link
Author

Golenko commented Nov 18, 2016

Thanks for your answer!
16.6.0 is the newest version supported by the license I have.
Is there any examples for older versions?

@sohail-aspose
Copy link
Collaborator

Yes, three APIs are available in v16.6.0 for “Find and Replace” feature.

replace(Pattern pattern, String replacement)
replace(String oldValue, String newValue, boolean isMatchCase, boolean isMatchWholeWord)
replace(Pattern pattern, IReplacingCallback handler, boolean isForward)

Example 1:

Document doc = new Document(dataDir + "ReplaceWithString.doc");
doc.getRange().replace(Pattern.compile("[s|m]ad"), "bad");
doc.save(dataDir + "ReplaceWithString_out.doc");

Example 2:

Document doc = new Document(dataDir + "ReplaceWithString.doc");
doc.getRange().replace("sad", "bad", false, true);
doc.save(dataDir + "ReplaceWithString_out.doc");

@Golenko
Copy link
Author

Golenko commented Nov 21, 2016

Thanks a lot!

@Golenko Golenko closed this as completed Nov 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants