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: [email protected]
Reporter: [email protected]
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: [email protected]
For additional commands, e-mail: [email protected]