DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43902>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43902

           Summary: HSSFSheet:autoSizeColumn doesn't consider merged regions
           Product: POI
           Version: 3.0
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


The autoSizeColumn method does not consider merged regions:

HSSFWorkbook wb = new HSSFWorkbook();
            HSSFSheet sheet = wb.createSheet("new sheet");
            //add two rows with each a cell
            HSSFRow row = sheet.createRow((short)0);
            HSSFCell cell = row.createCell((short)0);
            cell.setCellValue(new HSSFRichTextString("This is a Text"));
            HSSFRow row2 = sheet.createRow((short)1);
            HSSFCell cell2 = row2.createCell((short)0);
            cell2.setCellValue(new HSSFRichTextString("This is a very long 
long long Text"));
            
            //create a region over the 2nd row
            sheet.addMergedRegion(new Region(1,(short)0,1,(short)1));
            //auto size the Collumns
            sheet.autoSizeColumn((short)0);
            sheet.autoSizeColumn((short)1);

            // Write the output to a file
            FileOutputStream fileOut = new FileOutputStream("workbook.xls");
            wb.write(fileOut);
            fileOut.close();

If you use the autoSizeColumn function in Excel (double click) on the collumn 
heading, the collumn has the size of the first line. If you use the 
auotSizeColumn method of HSSFSheet it has the size of the 2nd.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to