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 43902] New: - HSSFSheet:autoSizeColumn doesn't consider merged regions
Date Mon, 19 Nov 2007 12:14:07 GMT
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: dev@poi.apache.org
        ReportedBy: andreas.radauer@porsche.co.at


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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message