poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ye...@apache.org
Subject svn commit: r1137138 - /poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java
Date Sat, 18 Jun 2011 08:39:03 GMT
Author: yegor
Date: Sat Jun 18 08:39:03 2011
New Revision: 1137138

URL: http://svn.apache.org/viewvc?rev=1137138&view=rev
Log:
improved autosizing columns in SXSSF, see Bug 51356

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java?rev=1137138&r1=1137137&r2=1137138&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java Sat Jun 18 08:39:03
2011
@@ -1069,8 +1069,14 @@ public class SXSSFSheet implements Sheet
     public void autoSizeColumn(int column, boolean useMergedCells)
     {
         double width = SheetUtil.getColumnWidth(this, column, useMergedCells);
-        if(width != -1){
-            setColumnWidth(column, (int)(width*256));
+
+        if (width != -1) {
+            width *= 256;
+            int maxColumnWidth = 255*256; // The maximum column width for an individual cell
is 255 characters
+            if (width > maxColumnWidth) {
+                width = maxColumnWidth;
+            }
+            setColumnWidth(column, (int)(width));
         }
     }
 



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


Mime
View raw message