poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 50681] New: autoSizeColumn sets column width beyond 255 character limit for XSSF sheets
Date Fri, 28 Jan 2011 16:48:58 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=50681

           Summary: autoSizeColumn sets column width beyond 255 character
                    limit for XSSF sheets
           Product: POI
           Version: 3.7
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: bryan_coleman@dart.biz


Using version 3.7

XSSFSheet.autoSizeColumn calculates the size of a large column beyond the 255
character maximum.  The HSSFSheet.autoSizeColumn does not do this.  I noticed
that bug 50211 combined the XSSF and HSSF autoSizeColumn methods.  I have not
tried the latest developer release; however, I wanted to get this in there to
make sure this bug isn't carried over from the XSSF class.

To reproduce:

import org.apache.poi.xssf.usermodel.*;
import java.io.*;

public class AutoSizeTest {

    public static void main(String args[]) {
        XSSFWorkbook workbook = new XSSFWorkbook();
        XSSFSheet    sheet = workbook.createSheet("");
        XSSFRow      row = sheet.createRow(0);
        XSSFCell     cell0 = row.createCell(0);

        cell0.setCellValue("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");

        sheet.autoSizeColumn(0);
        sheet.setColumnWidth(0, sheet.getColumnWidth(0)); // FAILS HERE

        try {
            FileOutputStream out = new FileOutputStream("working.xls");
            workbook.write(out);
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    } // main
}

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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