Browse Source

Revert changes from rev. 1513916 as it severly broke writing valid xlsx files

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1515842 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_3_10_BETA2
Dominik Stadler 10 years ago
parent
commit
70dc3d38ca

+ 7
- 6
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java View File

@@ -2689,14 +2689,15 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
}

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

+ 2
- 1
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java View File

@@ -462,7 +462,8 @@ public final class TestXSSFWorkbook extends BaseTestWorkbook {
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);

Loading…
Cancel
Save