monitorjbl / excel-streaming-reader

An easy-to-use implementation of a streaming Excel reader using Apache POI
Apache License 2.0
953 stars 344 forks source link

Unable to get row count in some cases #96

Open JavaGuruLMKR opened 7 years ago

JavaGuruLMKR commented 7 years ago

Hello,

I am receiving reference value as follows when StreamingSheetReader.handleElement's startElement.getName().getLocalPart() is "dimension" 1- ref=A1 (when there is only 1 sheet) 2- ref=A1:AU5121 (when there are 2 or more sheets) Your code is working fine in 2nd case but it always return 0 in first case. Please suggest some solution.

if(ref != null) { // ref is formatted as A1 or A1:F25. Take the last numbers of this string and use it as lastRowNum for(int i = ref.length() - 1; i >= 0; i--) { if(!Character.isDigit(ref.charAt(i))) { try { lastRowNum = Integer.parseInt(ref.substring(i + 1)) - 1; } catch(NumberFormatException ignore) { } break; } } }

Regards,

Mubashar Ahmad

JavaGuruLMKR commented 7 years ago

Where are you guyz, please help me i am in much trouble