Summary: | autoSizeColumn sets column width beyond 255 character limit for XSSF sheets and HSSF Sheets | ||
---|---|---|---|
Product: | POI | Reporter: | bryan_coleman |
Component: | XSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 3.8-dev | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Linux |
Description
bryan_coleman
2011-01-28 11:48:52 UTC
Please re-test with a recent svn checkout / nightly build and confirm if the problem is there or not. I do not have available time in the near future to test with the latest code base. If anyone has time available, please test using the code provided. If there is a jar that I can just drop into my application, I would probably have the fifteen minutes to try that within the next few weeks just let me know where to find it. I have tested the above code in 3.8 beta 3 and it failed. There is also a regression for HSSF Sheets. The following code works in POI 3.7, but fails in POI 3.8 beta3. package org.apache.poi.ss.examples; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.xssf.usermodel.*; import java.io.*; public class AutoSizeTest { public static void main(String args[]) { HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("Sheet1"); HSSFRow row = sheet.createRow(0); HSSFCell cell0 = row.createCell(0); String longValue = "www.hostname.com, www.hostname.com, " + "www.hostname.com, www.hostname.com, www.hostname.com, " + "www.hostname.com, www.hostname.com, www.hostname.com, " + "www.hostname.com, www.hostname.com, www.hostname.com, " + "www.hostname.com, www.hostname.com, www.hostname.com, " + "www.hostname.com, www.hostname.com, www.hostname.com, www.hostname.com"; cell0.setCellValue(longValue); sheet.autoSizeColumn(0); sheet.setColumnWidth(0, sheet.getColumnWidth(0)); // FAILS HERE try { FileOutputStream out = new FileOutputStream("C:/workspace/working.xls"); workbook.write(out); out.close(); } catch (Exception e) { e.printStackTrace(); } } // main } |