From 7351a3794c8229f9765810029dc426365fd8201a Mon Sep 17 00:00:00 2001 From: Yegor Kozlov Date: Sat, 11 Jun 2011 18:17:15 +0000 Subject: [PATCH] Bugzilla 51356: Support autoSizeColumn in SXSSF git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1134721 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/status.xml | 1 + .../java/org/apache/poi/xssf/streaming/SXSSFSheet.java | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 0c6acd0ce..5700f1deb 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 51356 - Support autoSizeColumn in SXSSF 51335 - Parse picture goal and crop sizes in HWPF 51305 - Add sprmTCellPaddingDefault support in HWPF 51265 - Enhanced Handling of Picture Parts in XWPF diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java index f5d2dc439..e5e27cdfe 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java @@ -26,6 +26,7 @@ import org.apache.poi.hpsf.IllegalPropertySetDataException; import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.util.CellReference; +import org.apache.poi.ss.util.SheetUtil; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.hssf.util.PaneInformation; @@ -1049,7 +1050,7 @@ public class SXSSFSheet implements Sheet, Cloneable */ public void autoSizeColumn(int column) { - _sh.autoSizeColumn(column); + autoSizeColumn(column, false); } /** @@ -1067,7 +1068,10 @@ public class SXSSFSheet implements Sheet, Cloneable */ public void autoSizeColumn(int column, boolean useMergedCells) { - _sh.autoSizeColumn(column, useMergedCells); + double width = SheetUtil.getColumnWidth(this, column, useMergedCells); + if(width != -1){ + setColumnWidth(column, (int)(width*256)); + } } /**