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

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


The HSSFSheet method autoSizeColumn() explicitly ignored text in merged cells,
and doesn't take indentation into consideration when calculating the preferred
width of a column.  The included patch does the following:

When it encounters a merged region in the column it will use the text of the
left-most cell in that row of the merged region as the base for calculating
width.  

On merged regions that do not span columns, this should always set the correct
column width.  

On regions that span columns, the total width needed for the text of the merged
region is divided by the number of columns the region spans, and that fraction
of the width is used for the width of the current column.  The width of other
columns in the merged region are not effected, so the total width of all the
columns would not be properly set unless you called autoSizeColumn on every
column in the merged region.  This approach can sometimes result in the
combined widths of the spanned columns being greater that what is necessary to
display the text in the merged region, but it is the only solution that I could
think of that would provide consistent results.

If the HSSFStyle of the cell contains indentation, the width of the indentation
is added to the calculated width necessary to display the text of the cell.


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

Reply via email to