<!-- Don't forget to update status.xml too! -->
<release version="3.5-beta6" date="2009-??-??">
+ <action dev="POI-DEVELOPERS" type="fix">47154 - Handle the cell format @ as the same as General</action>
<action dev="POI-DEVELOPERS" type="fix">47048 - Fixed evaluation of defined names with the 'complex' flag set</action>
<action dev="POI-DEVELOPERS" type="fix">46953 - More tweaks to PageSettingsBlock parsing logic in Sheet constructor</action>
<action dev="POI-DEVELOPERS" type="fix">47089 - Fixed XSSFWorkbook.createSheet to properly increment sheetId</action>
<!-- Don't forget to update changes.xml too! -->
<changes>
<release version="3.5-beta6" date="2009-??-??">
+ <action dev="POI-DEVELOPERS" type="fix">47154 - Handle the cell format @ as the same as General</action>
<action dev="POI-DEVELOPERS" type="fix">47048 - Fixed evaluation of defined names with the 'complex' flag set</action>
<action dev="POI-DEVELOPERS" type="fix">46953 - More tweaks to PageSettingsBlock parsing logic in Sheet constructor</action>
<action dev="POI-DEVELOPERS" type="fix">47089 - Fixed XSSFWorkbook.createSheet to properly increment sheetId</action>
if (format != null) {\r
return format;\r
}\r
- if (formatStr.equals("General")) {\r
+ if (formatStr.equals("General") || formatStr.equals("@")) {\r
if (DataFormatter.isWholeNumber(cellValue)) {\r
return generalWholeNumFormat;\r
}\r
import java.text.Format;
import java.util.Iterator;
+import org.apache.poi.hssf.HSSFTestDataSamples;
+
import junit.framework.TestCase;
/**
assertTrue(formatter.formatCellValue(cell).endsWith(" USD"));
}
}
+
+ /**
+ * A format of "@" means use the general format
+ */
+ public void testGeneralAtFormat() {
+ HSSFWorkbook workbook = HSSFTestDataSamples.openSampleWorkbook("47154.xls");
+ HSSFSheet sheet = workbook.getSheetAt(0);
+ HSSFRow row = sheet.getRow(0);
+ HSSFCell cellA1 = row.getCell(0);
+
+ assertEquals(HSSFCell.CELL_TYPE_NUMERIC, cellA1.getCellType());
+ assertEquals(2345.0, cellA1.getNumericCellValue(), 0.0001);
+ assertEquals("@", cellA1.getCellStyle().getDataFormatString());
+
+ HSSFDataFormatter f = new HSSFDataFormatter();
+
+ assertEquals("2345", f.formatCellValue(cellA1));
+ }
private static void log(String msg) {
if (false) { // successful tests should be silent