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
This commit is contained in:
Yegor Kozlov 2009-09-13 17:49:46 +00:00
parent bd966f208b
commit 8ca7addc26
3 changed files with 5 additions and 0 deletions

View 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>

View 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) {

View 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());
}
}