You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ye...@apache.org on 2009/05/30 12:37:09 UTC
svn commit: r780228 - in /poi/trunk/src:
documentation/content/xdocs/status.xml
ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCell.java
Author: yegor
Date: Sat May 30 10:37:08 2009
New Revision: 780228
URL: http://svn.apache.org/viewvc?rev=780228&view=rev
Log:
Fixed XSSFCell to avoid generating xsi:nil entries in shared string table
Modified:
poi/trunk/src/documentation/content/xdocs/status.xml
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCell.java
Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=780228&r1=780227&r2=780228&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Sat May 30 10:37:08 2009
@@ -34,6 +34,7 @@
<!-- 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>
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java?rev=780228&r1=780227&r2=780228&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java Sat May 30 10:37:08 2009
@@ -293,7 +293,7 @@
* If value is null then we will change the cell to a Blank cell.
*/
public void setCellValue(RichTextString str) {
- if(str == null){
+ if(str == null || str.getString() == null){
setBlank();
return;
}
Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCell.java?rev=780228&r1=780227&r2=780228&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCell.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCell.java Sat May 30 10:37:08 2009
@@ -19,6 +19,7 @@
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;
/**
@@ -79,4 +80,30 @@
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
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org