You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2013/06/17 10:17:17 UTC
[Bug 55105] New: autoSizeColumn not working properly for data type
values
https://issues.apache.org/bugzilla/show_bug.cgi?id=55105
Bug ID: 55105
Summary: autoSizeColumn not working properly for data type
values
Product: POI
Version: 3.9
Hardware: PC
Status: NEW
Severity: major
Priority: P2
Component: XSSF
Assignee: dev@poi.apache.org
Reporter: uogra@adobe.com
Workbook wb = new XSSFWorkbook();
CreationHelper createHelper = wb.getCreationHelper();
Sheet sheet = wb.createSheet();
Row row = sheet.createRow(0);
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setDataFormat((short) 14);
Cell cell = row.createCell(0);
cell.setCellType(Cell.CELL_TYPE_NUMERIC);
cell.setCellValue(new Date("13-jan-2013"));
cell.setCellStyle(cellStyle);
cell = row.createCell(1);
cell.setCellType(Cell.CELL_TYPE_STRING);
cell.setCellValue("13-jan-2013");
cell.setCellStyle(cellStyle);
sheet.autoSizeColumn(0, false);
sheet.autoSizeColumn(1, false);
In the above example I am adding 2 cells to different columns. One has string
type value and other has date type value. Value is same "13-jan-2013"
When I call autosizecolumn in both columns, first ccolumn doesnt exapnd to fit
in the data whereas 2nd column expands properly.
I noticed this thing :
Internally autosizecolumn is using SheetUtil.getColumnWidth to get current max
width of column. It is returning a value of 8 something.
Previously autosizecolumn was using ColumnHelper.getColumnWidth method and
used to return 12 for same data ("13-jan-2013"). This is why in previous
version autosizecolumn was working properly for even date type fields
--
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
[Bug 55105] autoSizeColumn not working properly for data type values
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55105
Bodo Wippermann <bo...@bodow.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |RESOLVED
Resolution|--- |INVALID
--- Comment #4 from Bodo Wippermann <bo...@bodow.de> ---
i don't see a bug here.
you are formatting the Date Cell with format id 14 which seems to be locale
dependent.
i tried this snippet
XSSFDataFormat format = wb.createDataFormat();
cellStyle.setDataFormat(format.getFormat("dd-MMM-yyyy"));
and both Colums are properly sized.
--
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
[Bug 55105] autoSizeColumn not working properly for data type values
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55105
--- Comment #3 from uogra@adobe.com ---
Any progress on this bug?
--
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
[Bug 55105] autoSizeColumn not working properly for data type values
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55105
Nick Burch <ap...@gagravarr.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
Do you have the correct fonts installed on your system and available to Java?
POI uses the fonts to work out how wide columns are, and it can't get it right
if Java doesn't have the fonts you're using available. Are they all correctly
there?
--
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
[Bug 55105] autoSizeColumn not working properly for data type values
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55105
--- Comment #2 from uogra@adobe.com ---
The same code if I run with 3.7 version runs fine and it properly autosizes the
column
But in 3.9 version it doesnt and internal implemented method returns lesser
value of max column width.
Both examples I have run on same system. Plus we have also run on other testing
systems
So I don't think fonts are the issue
--
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
[Bug 55105] autoSizeColumn not working properly for data type values
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55105
uogra@adobe.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |uogra@adobe.com
OS| |All
--
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