poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 57450] [PATCH] A way to autosize columns on SXSSF
Date Mon, 30 Nov 2015 00:35:19 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=57450

Javen O'Neal <onealj@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #15 from Javen O'Neal <onealj@apache.org> ---
Added in r1717146. Updated docs in r1717147.

Note to implementers:
This fix may break existing code.
If your application uses or potentially uses SXSSFSheets and calls
autoSizeColumn, you will need to make sure that the columns that are auto-sized
are tracked prior to auto-sizing. The best place to do this tracking is
immediately after the sheet is created.
Use any of the following:
* sxssfSheet.trackAllColumnsForAutoSizing()
* sxssfSheet.trackColumnsForAutoSizing(int column)
* sxssfSheet.trackColumnsForAutoSizing(Collection<Integer> columns)

Realize that tracking all columns may have a larger memory footprint than
tracking individual columns if you only intend on tracking some of the columns.

If the sheet type isn't known until runtime, you'll need to add the following
to your code.
Sheet sheet = workbook.createSheet();
+ if (sheet instanceof SXSSFSheet) {
+    SXSSFSheet sxSheet = (SXSSFSheet) sheet;
+    sxSheet.trackAllColumnsForAutoSizing();
+    // or track columns individually
+ }
...
sheet.autoSizeColumn(0);

See comment 13 for more info.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


Mime
View raw message