monitorjbl / excel-streaming-reader

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

Can I get data formateed value from a numberic cell #251

Open danmaidesenling opened 2 years ago

danmaidesenling commented 2 years ago

Hi, Can I get data formateed value from a numberic cell ? File file = new File("C:\\Users\\Marvinh\\Desktop\\wrong_2021120932 - Análises Fopag 12.2021.xlsx"); //XSSFWorkbook xssfWorkbook = new XSSFWorkbook(file); DataFormatter formatter = new DataFormatter(); Workbook workbook = StreamingReader.builder() .rowCacheSize(100) .bufferSize(1024) .open(file); for(Sheet sheet : workbook){ for(Row row : sheet){ if(row.getRowNum() == 27){ for(Cell cell2 : row){ if(cell2.getColumnIndex() == 8){ System.out.println(formatter.formatCellValue(cell2)); } } } } } this will occur issue with

com.monitorjbl.xlsx.exceptions.NotSupportedException at com.monitorjbl.xlsx.impl.StreamingCell.getSheet(StreamingCell.java:330) at org.apache.poi.ss.usermodel.DataFormatter.isDate1904(DataFormatter.java:313) at org.apache.poi.ss.usermodel.DataFormatter.getFormat(DataFormatter.java:309) at org.apache.poi.ss.usermodel.DataFormatter.getFormattedNumberString(DataFormatter.java:858) at org.apache.poi.ss.usermodel.DataFormatter.formatCellValue(DataFormatter.java:1011) at org.apache.poi.ss.usermodel.DataFormatter.formatCellValue(DataFormatter.java:961) at org.apache.poi.ss.usermodel.DataFormatter.formatCellValue(DataFormatter.java:940)

on System.out.println(formatter.formatCellValue(cell2));

Is there anyway to fix this in version 2.1.0 ? Or Does this be handled in the latest verison ?

pjfanning commented 2 years ago

you also created #252 - your issue is basically a duplicate of #193

danmaidesenling commented 2 years ago

you also created #252 - your issue is basically a duplicate of #193

Thank you ! Have closed #252 I will update xlsx-streamer version to 2.2.0 and try.