Summary: | [Patch] Broken auto fit row height in the cells with word wrap | ||
---|---|---|---|
Product: | POI | Reporter: | Dmitry Yakubovich <dmitry> |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | major | CC: | knst.kolinko |
Priority: | P2 | Keywords: | PatchAvailable |
Version: | 3.8-dev | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows Vista | ||
Attachments: |
Java code produce ugly xls file
xls file with autosize height ok xls file with autosize height ugly Patch in two variants 2012-09-26_poi_53028_c10.patch - Patch for Comment 10 |
Description
Dmitry Yakubovich
2012-04-03 03:02:41 UTC
Can you post sample code that demonstrates the issue? I would like to see a sample code that used to work before r1243240 and produces bad output now. Also, does the problem show itself in all versions of Excel? Which version of MS Office are you using? Yegor Created attachment 28536 [details]
Java code produce ugly xls file
Created attachment 28537 [details]
xls file with autosize height ok
Created attachment 28538 [details]
xls file with autosize height ugly
I added an example with code and output files. I think it does not depend on the version of MS Office. Checked in Office 2007, 2003. OK, thanks. Something to work for me in the POI-3.9 dev cycle. Regards, Yegor Hi, is this issue because of this bug ? http://stackoverflow.com/questions/10978307/apache-poi-excel-hssf-wrap-text-issue Created attachment 29053 [details]
Patch in two variants
Seems like auto fit with HSSFSheet.setDefaultRowHeight is mission impossible due to option bit #1 in DefaultRowHeightRecord, at least in OpenOffice 3.2.1. Auto fit
should work at least when setDefaultRowHeight isn't used.
This problem should be fixed in trunk. Please try with a nightly build - see download links on http://poi.apache.org/ or build yourself from SVN trunk, see http://poi.apache.org/subversion.html Thank you for fixing this issue. First, this issue is just "Broken auto fit row height". I agree that the issue is more apparent for cells that have word wrap, but it is also observable in different circumstances. E.g. if I have a cell with a font which is bigger than the default height of the row. Confirming, that this issue is observable with "3.8" release, I do not see it with "3.8-beta5", and it is fixed in the current nightly (20120924). I am using Excel 2003. Just FYI: I also tried to verify this with LibreOffice 3.6.1 on Windows and the auto fit of row height is broken there (the row is displayed using its default height). It is their fault, not yours. A report in their bugzilla: https://www.libreoffice.org/bugzilla/show_bug.cgi?id=34717 Second, reviewing the fix in r1373005 I see an inconsistency: There are 2 methods in org.apache.poi.hssf.usermodel.HSSFRow: - HSSFRow.setHeight(short) - HSSFRow.setHeightInPoints(float) Both methods have special processing for the value of (-1). In r1373005 the fix was applied to the setHeight() method only. I am REOPENING this issue, so that setHeightInPoints() be fixed as well. Created attachment 29420 [details] 2012-09-26_poi_53028_c10.patch - Patch for Comment 10 Here is proposed fix and test for Comment 10 - HSSFRow.setHeightInPoints(). I do not have dev environment for POI, so this is untested. Applied via r1763484, will be included in 3.16-beta1, thanks for the Patch and Test. |