import java.io.IOException;\r
import java.io.OutputStream;\r
import java.nio.charset.Charset;\r
+import java.text.DecimalFormat;\r
+import java.text.DecimalFormatSymbols;\r
import java.util.Calendar;\r
import java.util.Date;\r
import java.util.Iterator;\r
assertEquals(DateUtil.getJavaDate(value1, false), DateUtil.getJavaDate(value2, false));\r
}\r
\r
- @Test\r
- public void test57236() throws Exception {\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
- wb.close();\r
- }\r
-\r
// When this is fixed, the test case should go to BaseTestXCell with \r
// adjustments to use _testDataProvider to also verify this for XSSF\r
@Test\r
assertEquals(1, wb.getNumberOfSheets());
assertEquals("Sheet1", wb.getSheetName(0));
}
+
+ @Test
+ public void test57236() throws Exception {
+ // Having very small numbers leads to different formatting, Excel uses the scientific notation, but POI leads to "0"
+
+ /*
+ DecimalFormat format = new DecimalFormat("#.##########", new DecimalFormatSymbols(Locale.getDefault()));
+ double d = 3.0E-104;
+ assertEquals("3.0E-104", format.format(d));
+ */
+
+ DataFormatter formatter = new DataFormatter(true);
+
+ XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("57236.xlsx");
+ for(int sheetNum = 0;sheetNum < wb.getNumberOfSheets();sheetNum++) {
+ Sheet sheet = wb.getSheetAt(sheetNum);
+ for(int rowNum = sheet.getFirstRowNum();rowNum < sheet.getLastRowNum();rowNum++) {
+ Row row = sheet.getRow(rowNum);
+ for(int cellNum = row.getFirstCellNum();cellNum < row.getLastCellNum();cellNum++) {
+ Cell cell = row.getCell(cellNum);
+ String fmtCellValue = formatter.formatCellValue(cell);
+
+ System.out.println("Cell: " + fmtCellValue);
+ assertNotNull(fmtCellValue);
+ assertFalse(fmtCellValue.equals("0"));
+ }
+ }
+ }
+
+ wb.close();
+ }
}