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

Free Support Forum - aspose.com

doc.getRange().replace don't work in some case

Document doc = new Document(“d:/a/fetal3.doc”);

LayoutEnumerator enumerator = new LayoutEnumerator(doc);
//i need instance of LayoutEnumerator,so i created it ,but this seem to cause replacement failure
//if i do not construct LayoutEnumerator,replacement work as expected
FindReplaceOptions options = new FindReplaceOptions();
options.setDirection(FindReplaceDirection.FORWARD);
options.setReplacingCallback(new IReplacingCallback() {
@Override
public int replacing(ReplacingArgs target) throws Exception {
target.setReplacement(“abc”);
return 0;
}
});
doc.getRange().replace(Pattern.compile("\$(.?)\{(.*?)\}"), “”, options);
doc.save(“d:/a/fetal3.pdf”, SaveFormat.PDF);

A post was merged into an existing topic: doc.getRange().replace(reg,options) don’t work in some case