@priyanga,
Thanks for your inquiry. Please use the following code example to get the desired output.
Document doc = new Document(MyDir + "in.docx");
FindReplaceOptions findReplaceOptions = new FindReplaceOptions();
FindFigureCaption callback = new FindFigureCaption();
findReplaceOptions.setReplacingCallback(callback);
doc.getRange().replace("Figure", "", findReplaceOptions);
System.out.println(callback.mMatchNumber);
class FindFigureCaption implements IReplacingCallback {
public int mMatchNumber;
public int replacing(ReplacingArgs e) throws Exception {
mMatchNumber++;
return ReplaceAction.SKIP;
}
}