https://issues.apache.org/bugzilla/show_bug.cgi?id=53028
Bug #: 53028
Summary: Broken auto fit row height in the cells with word wrap
Product: POI
Version: 3.8-dev
Platform: PC
OS/Version: Windows Vista
Status: NEW
Severity: major
Priority: P2
Component: HSSF
AssignedTo: [email protected]
ReportedBy: [email protected]
Classification: Unclassified
After resolve bug (ID 45472) a commit (Revision 1,243,240) broke the usual
behavior of xls files created through the POI.
Previously, if the row had not been set height then it was a flag
RowRecord.setBadFontHeight(false) and cell with word wrap text,
which gave the auto fit of the row height when opening the file in Excel.
Now in HSSFSheet.createRow is calling HSSFRow. setHeight which resets flag
RowRecord.setBadFontHeight(true). What does Excel and then fit the row height
of the text in cells with word wrapping.
Yet please note that HSSFRow.setHeight c height == -1 does not reset the flag
of in RowRecord.setBadFontHeight(false), and don't access to private variable
row type RowRecord.
I suggest the following options:
For the method **** HSSFSheet.createRow ****
1. Make a check on the set getDefaultRowHeight other than 255
if (getDefaultRowHeight ()! = 255)
row.setHeight (getDefaultRowHeight ());
2. Make another version of the createRow with a different name, or add an
parameter to will create a row with no fixed working height and auto height
fit.
For the method **** HSSFRow.setHeight ****
1. In the case of height == -1, reset the flag
RowRecord.setBadFontHeight(false).
if (height == -1) {
RowRecord.setBadFontHeight (false);
row.setHeight ((short) (0xFF | 0x8000));
} else {
2. For the class HSSFRow add a method to access BadFontHeight ie getter and
setter
--
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: [email protected]
For additional commands, e-mail: [email protected]