poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 51622] autoSizeColumn does not sizes text when we have leading space in the cell
Date Wed, 04 Nov 2015 03:28:53 GMT

--- Comment #2 from Javen O'Neal <onealj@apache.org> ---
Created attachment 33253
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33253&action=edit
SheetUtil.java fix

This problem still exists in POI 3.13 and the latest 3.14 dev build. Cell width
computation is done in org.apache.poi.ss.util.SheetUtil, so this bug is common
to HSSF, XSSF, and SXSSF workbooks.

The problem is here[1]:
> private static double getCellWidth(int defaultCharWidth, int colspan,
>         CellStyle style, double width, AttributedString str) {
> ...
>     width = Math.max(width, ((layout.getBounds().getWidth() / colspan) / defaultCharWidth)
+ style.getIndention());

Should be (bounds.getX() + bounds.getWidth()), since the bounding box starts at
the first non-whitespace character.

This patch is untested and needs a corresponding unit tests before it can be


You are receiving this mail because:
You are the assignee for the bug.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message