<!-- Don't forget to update changes.xml too! -->
<changes>
<release version="3.5-beta6" date="2009-??-??">
+ <action dev="POI-DEVELOPERS" type="fix">47278 - Fixed XSSFCell to avoid generating xsi:nil entries in shared string table</action>
<action dev="POI-DEVELOPERS" type="fix">47206 - Fixed XSSFCell to properly read inline strings</action>
<action dev="POI-DEVELOPERS" type="add">47250 - Fixed FontRecord to expect unicode flags even when name length is zero</action>
<action dev="POI-DEVELOPERS" type="add">47198 - Fixed formula evaluator comparison of -0.0 and 0.0</action>
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.XSSFITestDataProvider;
+import org.apache.poi.xssf.model.SharedStringsTable;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STCellType;
/**
assertTrue(cell_2.getCTCell().isSetIs());
assertEquals("bar", row.getCell(2).getStringCellValue());
}
+
+ /**
+ * Bug 47278 - xsi:nil attribute for <t> tag caused Excel 2007 to fail to open workbook
+ */
+ public void test47278() throws Exception {
+ XSSFWorkbook wb = (XSSFWorkbook)_testDataProvider.createWorkbook();
+ XSSFSheet sheet = wb.createSheet();
+ XSSFRow row = sheet.createRow(0);
+ SharedStringsTable sst = wb.getSharedStringSource();
+ assertEquals(0, sst.getCount());
+
+ //case 1. cell.setCellValue(new XSSFRichTextString((String)null));
+ XSSFCell cell_0 = row.createCell(0);
+ XSSFRichTextString str = new XSSFRichTextString((String)null);
+ assertNull(str.getString());
+ cell_0.setCellValue(str);
+ assertEquals(0, sst.getCount());
+ assertEquals(XSSFCell.CELL_TYPE_BLANK, cell_0.getCellType());
+
+ //case 2. cell.setCellValue((String)null);
+ XSSFCell cell_1 = row.createCell(1);
+ cell_1.setCellValue((String)null);
+ assertEquals(0, sst.getCount());
+ assertEquals(XSSFCell.CELL_TYPE_BLANK, cell_1.getCellType());
+ }
+
}
\ No newline at end of file