It depends on how you decide (in you code) to what style each cell must get. If you have embedded the styles logic in your code, you can simply do something like this:

HSSFWorkbook wb=createWorkBookSomeHow();
HSSFCellStyle cellStyle;
cellStyle = wb.createCellStyle();
//Setup the cell style
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
...
cell1.setCellStyle(cellStyle);
cell2.setCellStyle(cellStyle);
cell2.setCellStyle(cellStyle);

This way all the cells will get a shared cell style.  If you have some templating kind of system, where cell styles are dictated by a template, you may want to create a cell style cache so that similarly formatted cells use shared cellstyle objects.


Regards
Tahir Akhtar
[EMAIL PROTECTED] wrote:
That's what I thought, too.  I was setting a style on each cell and upgraded to POI version 3.0 in order to be able to set a style on a column.  Setting a default style for a column did not seem to have an effect on the file size.  Is there another way to set styles that is better?

---- Tahir Akhtar <[EMAIL PROTECTED]> wrote: 
  
Look into the per-cell records you are creating. For example you might 
be creating a unique Cell Format object for each cell although all the 
cell contain same formatting.
[EMAIL PROTECTED] wrote:
    
Does anyone have any suggestions on optimizing the file size of an Excel spreadsheet created with POI?

I need to create a spreadsheet with a relatively large amout of data (5-8 full sheets with 10 or so columns) and when I create it with POI it is more than twice the size as when I create it manually.

Thanks,

Marshall

---------------------------------------------------------------------
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]

    


---------------------------------------------------------------------
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]

Reply via email to