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

Reply via email to