Sfoglia il codice sorgente

fixed XSSFSheet.setColumnWidth to produce XML compatible with Mac Excel 2008, see Bugzilla 47581

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@814358 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_3_5-FINAL
Yegor Kozlov 14 anni fa
parent
commit
a90c8202db

+ 1
- 0
src/documentation/content/xdocs/status.xml Vedi File

@@ -33,6 +33,7 @@

<changes>
<release version="3.5-beta7" date="2009-??-??">
<action dev="POI-DEVELOPERS" type="fix">47581 - fixed XSSFSheet.setColumnWidth to produce XML compatible with Mac Excel 2008</action>
<action dev="POI-DEVELOPERS" type="fix">47734 - removed unnecessary svn:executable flag from files in SVN trunk</action>
<action dev="POI-DEVELOPERS" type="fix">47543 - added javadoc how to avoid Excel crash when creating too many HSSFRichTextString cells</action>
<action dev="POI-DEVELOPERS" type="fix">47813 - fixed problems with XSSFWorkbook.removeSheetAt when workbook contains chart</action>

+ 1
- 0
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java Vedi File

@@ -1675,6 +1675,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
if(width > 255*256) throw new IllegalArgumentException("The maximum column width for an individual cell is 255 characters.");

columnHelper.setColWidth(columnIndex, (double)width/256);
columnHelper.setCustomWidth(columnIndex, true);
}

public void setDefaultColumnStyle(int column, CellStyle style) {

+ 3
- 0
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java Vedi File

@@ -695,6 +695,7 @@ public class TestXSSFSheet extends BaseTestSheet {
assertEquals(2, col.getMin());
assertEquals(2, col.getMax());
assertEquals(22.0, col.getWidth(), 0.0);
assertTrue(col.getCustomWidth());

// Now set another
sheet.setColumnWidth(3, 33 * 256);
@@ -708,10 +709,12 @@ public class TestXSSFSheet extends BaseTestSheet {
assertEquals(2, col.getMin()); // POI 1
assertEquals(2, col.getMax());
assertEquals(22.0, col.getWidth(), 0.0);
assertTrue(col.getCustomWidth());

col = cols.getColArray(1);
assertEquals(4, col.getMin()); // POI 3
assertEquals(4, col.getMax());
assertEquals(33.0, col.getWidth(), 0.0);
assertTrue(col.getCustomWidth());
}
}

Loading…
Annulla
Salva