https://issues.apache.org/bugzilla/show_bug.cgi?id=46015
Summary: simpler usage for HSSFCellStyle?
Product: POI
Version: 3.1
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: HSSF
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
Just a suggestion...
It seems like the HSSFStyle API is designed more around the internals of the
xls file format than around what a programmer would want to do when building a
spreadsheet.
For example, I've been trying to figure out how to manage the global list of
HSSFCellStyles and reuse existing ones where possible. It seems like the
easiest way to do this would be to build a reference style with all the
settings you want for a particular cell and then enumerate over all the
existing styles in the workbook to see if there's a match.
If so, would it not make sense to add the following methods to the HSSFCell
class to automate that procedure and hide it from the user:
HSSFCellStyle getNewStyle();
Produce a temporary HSSFCellStyle, where you could set all the parameters you
want, without attaching it to the workbook.
void applyNewStyle(HSSFCellStyle style);
Scan all the styles in the workbook and if there's a match, apply the existing
style to the cell. If not, attach the new style to the workbook and apply it
to the cell.
It certainly seems like that's what Excel does when you restyle a cell. It
certainly does not just apply the change to a global style that the cell shares
with others, in applying the change to all the shared cells.
Does this sound reasonable? I'd submit a patch if I understood the POI
codebase better.
--
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]