Le 29/07/2014 07:29, erebusmali...@gmail.com a écrit :
I have run into an oddity, having done some searching I can not find
mention of.

I have a large spreadsheet that is created very similar to the example
"getting started", where I use a TableModel.   The spreadsheet has 5
columns, and aproximately 8000 rows.

The data is saved 100% correctly in the resulting spreadsheet file.

I wrote code to set the background colors of certain rows (cells that make
up those rows anyway) as follows:



if ( c.getBackground() != null ) {
                 try {
                     sheet.getCellAt( getCellName( c ) ).setBackgroundColor(
c.getBackground() );
                 } catch ( Exception e ) {
                     e.printStackTrace();
                 }
             }

I am wondering if I am hitting some sort of limit on the amount of rows or
a hidden underlying limit in the xml that defines the document?  I'm not
entirely sure what is coming up null in the process, vs any other previous
invocation of the setBackgroundColor() method.

Hi,

Yes there was some limit in the creation of styles. The limit is now replaced by a warning, as the process of creating and saving thousands of styles is slow. If you have a limited pool of colors, a better approach would be to create one style for each color and then apply them to cells :

CellStyle cellStyle = sheet.getStyleStyleDesc(CellStyle.class).createAutoStyle(sheet.getSpreadSheet().getPackage());
        cellStyle.getTableCellProperties(null).setBackgroundColor(color);

        sheet.getCellAt(x,y).setStyleName(cellStyle.getName());


Cheers,
Sylvain

--

--- You received this message because you are subscribed to the Google Groups "jOpenDocument" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to