monitorjbl / excel-streaming-reader

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

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

Closed danmaidesenling closed 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"); 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 ?