You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2011/06/15 22:44:06 UTC

DO NOT REPLY [Bug 50681] autoSizeColumn sets column width beyond 255 character limit for XSSF sheets and HSSF Sheets

https://issues.apache.org/bugzilla/show_bug.cgi?id=50681

jxz164@hotmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|3.7                         |3.8-dev
            Summary|autoSizeColumn sets column  |autoSizeColumn sets column
                   |width beyond 255 character  |width beyond 255 character
                   |limit for XSSF sheets       |limit for XSSF sheets and
                   |                            |HSSF Sheets

--- Comment #3 from jxz164@hotmail.com 2011-06-15 20:44:06 UTC ---
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
}

-- 
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