\r
import org.apache.poi.hssf.HSSFTestDataSamples;\r
import org.apache.poi.ss.usermodel.Cell;\r
+import org.apache.poi.ss.usermodel.DataFormatter;\r
import org.apache.poi.ss.usermodel.Row;\r
import org.apache.poi.ss.usermodel.Sheet;\r
import org.apache.poi.ss.usermodel.Workbook;\r
}\r
}\r
}\r
+\r
+\r
+ public void test57236() {\r
+ // Having very small numbers leads to different formatting, Excel uses the scientific notation, but POI leads to "0"\r
+ \r
+ /*\r
+ DecimalFormat format = new DecimalFormat("#.##########", new DecimalFormatSymbols(Locale.getDefault()));\r
+ double d = 3.0E-104;\r
+ assertEquals("3.0E-104", format.format(d));\r
+ */\r
+ \r
+ DataFormatter formatter = new DataFormatter(true);\r
+\r
+ XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("57236.xlsx");\r
+ for(int sheetNum = 0;sheetNum < wb.getNumberOfSheets();sheetNum++) {\r
+ Sheet sheet = wb.getSheetAt(sheetNum);\r
+ for(int rowNum = sheet.getFirstRowNum();rowNum < sheet.getLastRowNum();rowNum++) {\r
+ Row row = sheet.getRow(rowNum);\r
+ for(int cellNum = row.getFirstCellNum();cellNum < row.getLastCellNum();cellNum++) {\r
+ Cell cell = row.getCell(cellNum);\r
+ String fmtCellValue = formatter.formatCellValue(cell);\r
+ \r
+ System.out.println("Cell: " + fmtCellValue);\r
+ assertNotNull(fmtCellValue);\r
+ assertFalse(fmtCellValue.equals("0"));\r
+ }\r
+ }\r
+ }\r
+ }\r
}\r