You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Martin Studer <ma...@mirai-solutions.com> on 2010/07/30 12:25:12 UTC
User-defined cell styles in HSSF and XSSF
Hi all,
I'm using POI 3.7-beta1 and currently working with (user-)named CellStyles
(HSSF and XSSF workbooks).
For HSSF workbooks I wanted to do something like this:
HSSFWorkbook wb = ...
HSSFCellStyle cs = wb.createCellStyle();
cs.setUserStyleName(name);
However, when I try to do that I get an "Unable to set user specified style
names for built in styles!" exception. When I'm creating a new cell style, I
shouldn't be getting a built-in style, should I?
Also, for XSSF workbooks I currently didn't find a way to directly deal with
user defined style names. Is this something which is planned for the 3.7
release?
Thank you for your help,
Martin
Re: User-defined cell styles in HSSF and XSSF
Posted by Nick Burch <ni...@alfresco.com>.
On Fri, 30 Jul 2010, Martin Studer wrote:
> HSSFWorkbook wb = ...
> HSSFCellStyle cs = wb.createCellStyle();
> cs.setUserStyleName(name);
>
> However, when I try to do that I get an "Unable to set user specified style
> names for built in styles!" exception. When I'm creating a new cell style, I
> shouldn't be getting a built-in style, should I?
Looks to be a bug. I've put this in bugzilla as
https://issues.apache.org/bugzilla/show_bug.cgi?id=49689
> Also, for XSSF workbooks I currently didn't find a way to directly deal
> with user defined style names. Is this something which is planned for
> the 3.7 release?
Only if you fancy writing the patch! :)
Try creating a file in excel, which is very simple and has for example one
cell with a user defined style name. Unzip the .xlsx file (it's really
just a zip file), and see which bits of xml are involved. That should tell
you the xmlbeans bean to expose, then wrap that with some XSSF usermodel
code. Finally, add a unit test, and upload the patch to bugzilla :)
Cheers
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org