You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Nidhi Tuli <nt...@paymentone.com> on 2006/06/30 19:19:12 UTC

"To many different cell formats"

My excel has lot of data. It consists of 3 sheets and all three sheets
have 300 rows with 15 columns. And we need all the rows and cells to
have the borders so that its readable. So I used following code snippet
for each cell. 
 
 
HSSFCellStyle style = wb.createCellStyle();
                        
style.setBorderTop(HSSFCellStyle.BORDER_THIN);
style.setTopBorderColor(HSSFColor.BLACK.index);
style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style.setBottomBorderColor(HSSFColor.BLACK.index);
style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style.setLeftBorderColor(HSSFColor.BLACK.index);
style.setBorderRight(HSSFCellStyle.BORDER_THIN);
style.setRightBorderColor(HSSFColor.BLACK.index);
cell.setCellStyle(style);
 
When I create and format these cells POI does not complain anything. But
when I open the huge excel with that much formatting it complains "To
many different call formats". 
 
Any idea how to get ride of this?
 
Thanks in advance.
Nidhi
 
 

Re: "To many different cell formats"

Posted by "William S. Hayes" <ws...@fluctus.com>.
2 ideas:

simple tabular output: just create one style for each column, then reuse 
that style each time you output an item in that particular style.

complex reports where all the styles needed are not necessarily known:  
Write an object that acts as a cache for the styles used so far.  So 
each time you go to create a style, check the cache to see if it still 
exists, if so use that one, otherwise create a new style and add it to 
the cache.

scott

Nidhi Tuli wrote:
> My excel has lot of data. It consists of 3 sheets and all three sheets
> have 300 rows with 15 columns. And we need all the rows and cells to
> have the borders so that its readable. So I used following code snippet
> for each cell. 
>  
>  
> HSSFCellStyle style = wb.createCellStyle();
>                         
> style.setBorderTop(HSSFCellStyle.BORDER_THIN);
> style.setTopBorderColor(HSSFColor.BLACK.index);
> style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
> style.setBottomBorderColor(HSSFColor.BLACK.index);
> style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
> style.setLeftBorderColor(HSSFColor.BLACK.index);
> style.setBorderRight(HSSFCellStyle.BORDER_THIN);
> style.setRightBorderColor(HSSFColor.BLACK.index);
> cell.setCellStyle(style);
>  
> When I create and format these cells POI does not complain anything. But
> when I open the huge excel with that much formatting it complains "To
> many different call formats". 
>  
> Any idea how to get ride of this?
>  
> Thanks in advance.
> Nidhi
>  
>  
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/