Author: centic
Date: Tue Aug 20 15:03:18 2013
New Revision: 1515842

URL: http://svn.apache.org/r1515842
Log:
Revert changes from rev. 1513916 as it severly broke writing valid xlsx files

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
    
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java?rev=1515842&r1=1515841&r2=1515842&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java 
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java Tue 
Aug 20 15:03:18 2013
@@ -2689,14 +2689,15 @@ public class XSSFSheet extends POIXMLDoc
     }
 
     protected void write(OutputStream out) throws IOException {
-
         if(worksheet.sizeOfColsArray() == 1) {
-            CTCols col = worksheet.getColsArray(0);
-            if(col.sizeOfColArray() != 0) {
+               CTCols col = worksheet.getColsArray(0);
+            if(col.sizeOfColArray() == 0) {
+               // this is necessary so that we do not write an empty <cols/> 
item into the sheet-xml in the xlsx-file
+               // Excel complains about a corrupted file if this shows up 
there!
+                worksheet.setColsArray(null);
+            } else {
                setColWidthAttribute(col);
-            } /*else {
-               remove, see Bug 52233: worksheet.setColsArray(null);
-            }*/
+            }
         }
 
         // Now re-generate our CTHyperlinks, if needed

Modified: 
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java?rev=1515842&r1=1515841&r2=1515842&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java
 (original)
+++ 
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java
 Tue Aug 20 15:03:18 2013
@@ -462,7 +462,8 @@ public final class TestXSSFWorkbook exte
                 sh.getCTWorksheet().getSheetPr().getTabColor().getIndexed());
     }
 
-       public void testColumnWidthPOI52233() throws Exception {
+    // TODO: disabled as the fix for this had severe side-effects
+       public void doNotRuntestColumnWidthPOI52233() throws Exception {
                XSSFWorkbook workbook = new XSSFWorkbook();
                XSSFSheet sheet = workbook.createSheet();
                XSSFRow row = sheet.createRow(0);



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org
For additional commands, e-mail: commits-h...@poi.apache.org

Reply via email to