Posted 4 April 2020, 2:34 am EST
I’m getting an error while looking for all cells with a specific keyword in a sheet. Once the algorithm reaches lastly found cell the process hangs after line number 47.
range = searchRange.find("GETCELL", range, fo);
It is precisely shown on the video:
Here is a Java method containing the algorithm based on docs published by Grapecity:
@Override
public Set<String> extractParams(String json) {
final Map<String, String> results = new HashMap<String, String>();
// create a new workbook
final Workbook workbook = new Workbook(Licenses.GC_DOCUMENTS_LICENSE);
workbook.fromJson(json);
for (final IWorksheet worksheet : workbook.getWorksheets()) {
final FindOptions fo = new FindOptions();
fo.setLookIn(FindLookIn.Formulas);
IRange range = null;
final IRange searchRange = worksheet.getCells();
do {
System.out.println("pre find range: " + range);
range = searchRange.find("GETCELL", range, fo);
System.out.println("newly found range: " + range);
if (range != null) {
results.put(range.toString(), range.getFormula());
// System.out.println("extractParams() results: " + results);
}
} while (range != null);
System.out.println(searchRange);
}
System.out.println("extractParams() results: " + results);
return null;
}
I tested and repeated this behavior with versions 3.0.4 and 3.1.0. Please help to resolve this issue.