Hi all, I've been having a further play with CellStyles and XSSFWorkbooks. I'm having problems with being able to correctly reference a CellStyle. I could pin the problem down to the following:
Workbook wb = ... int before = wb.getNumCellStyles(); wb.createCellStyle(); int after = wb.getNumCellStyles(); Both, 'after' and 'before' give 1 for me. I guess this is a bug? Thanks, Martin 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
