R
Rob Y.
In Apache POI-HSSF, it seems like the HSSFCellStyle is global to the
workbook. I assume that means that in order to, say, color cells as
you add them, creating a new HSSFCellStyle for each would be hugely
inefficient.
But if my data source makes it difficult to know all possible cell
styles upfront (especially, since cell styles are combinations of
font, color, border, etc), how can I know when I need to create a new
one? I suppose I could keep a table of all the style parameter
combinations I've encountered, but doesn't the library already do
this?
I guess my bottom-line question: is there a way to query your
workbook to find out whether a cell style you want to use matches one
that's already in the workbook and to use that instead? Or, put
another way, does Excel allocate separate cell style records for each
cell, or does it dynamically figure out which styles are unique and
only store them when it needs to? If I were to create a spreadsheet
where all the green cells shared a single cell style, would a user
changing a single cell's color end up changing them all?
Rob
workbook. I assume that means that in order to, say, color cells as
you add them, creating a new HSSFCellStyle for each would be hugely
inefficient.
But if my data source makes it difficult to know all possible cell
styles upfront (especially, since cell styles are combinations of
font, color, border, etc), how can I know when I need to create a new
one? I suppose I could keep a table of all the style parameter
combinations I've encountered, but doesn't the library already do
this?
I guess my bottom-line question: is there a way to query your
workbook to find out whether a cell style you want to use matches one
that's already in the workbook and to use that instead? Or, put
another way, does Excel allocate separate cell style records for each
cell, or does it dynamically figure out which styles are unique and
only store them when it needs to? If I were to create a spreadsheet
where all the green cells shared a single cell style, would a user
changing a single cell's color end up changing them all?
Rob