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 2019/03/18 10:40:54 UTC
[Bug 63268] New: CellUtil setFont always creates new style
https://bz.apache.org/bugzilla/show_bug.cgi?id=63268
Bug ID: 63268
Summary: CellUtil setFont always creates new style
Product: POI
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P2
Component: SS Common
Assignee: dev@poi.apache.org
Reporter: oliver.flege@finasoft.de
Target Milestone: ---
Setting the font of a cell using CellUtil.setFont(cell, font) always creates a
new style in the workbook, regardless of whether the font is new or not, and
may therefore lead to "IllegalStateException: The maximum number of cell styles
was exceeded".
Problem seems to be that the private putAll method in CellUtil stores a Short
value for the font in the map, whereas getFormatProperties(CellStyle style)
uses an Int, so that the "if (wbStyleMap.equals(values))" call in
setCellStyleProperties will always return false.
Steps to reproduce:
HSSFWorkbook wb = new HSSFWorkbook();
HSSFCell c = wb.createSheet().createRow(1).createCell(1);
HSSFFont f = wb.createFont();
CellUtil.setFont(c, f);
int num1 = wb.getNumCellStyles();
CellUtil.setFont(c, f);
int num2 = wb.getNumCellStyles();
System.out.println(num1 == num2); // should print true, prints false
--
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 63268] CellUtil setFont always creates new style
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63268
PJ Fanning <fa...@yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #1 from PJ Fanning <fa...@yahoo.com> ---
Fix applied with https://svn.apache.org/viewvc?view=revision&revision=1855806
--
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