Summary: | [PATCH] Support for named cell styles in SS Common | ||
---|---|---|---|
Product: | POI | Reporter: | Martin Studer <martin.studer> |
Component: | SS Common | Assignee: | POI Developers List <dev> |
Status: | NEW --- | ||
Severity: | enhancement | CC: | martin.studer |
Priority: | P2 | Keywords: | PatchAvailable |
Version: | 3.16-dev | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Linux | ||
Attachments: | Patch adding support for named cell styles |
Created attachment 34826 [details] Patch adding support for named cell styles Dear all, I was working on support for named cell styles in SS Common. Please find attached a patch with the proposed changes. Would be great if someone could review that. While HSSFCellStyle allowed setting a user style name for a while, this was not possible with XSSFCellStyle. Generally, the model in XSSF is a bit more complicated due to the separation of cell and cell style formatting records (cell xfs vs cell style xfs). An XSSFCellStyle in POI is generally a combination of both a cell xf and a cell style xf. Only the latter (actually only cell styles (CTCellStyle) which reference a cell style xf) can have a name. The idea of supporting named cell styles in XSSFCellStyle is therefore the following: - an XSSFCellStyle which references an "empty" cell xf (i.e. no cell-specific formatting) which in turn references a cell style xf which has a name through a cell style record (CTCellStyle) is considered a named XSSFCellStyle - a named XSSFCellStyle can be created at any time from a (non-named) XSSFCellStyle by merging the cell xf and cell style xf information and creating a new cell style xf record and an appropriate CTCellStyle entry; the XSSFCellStyle can be updated by using the newly created cell style xf and an empty cell xf A test case which illustrates the use is included in the attached patch. Best regards, Martin