Getting maximum number of fonts have been exceeded error

S

SJ

Hi Team,

I am using HSSfWorkbook to create work books using POI API. It has been
working fine. But whenever the date is more and when I try to upload XL sheet
it is giving "
Maximum number of fonts have been exceeded error "

Any pointers in this regard are appreciated.
Thanks in Advance
SJ
 
J

Joel

We get a similar message in one of our applications. I suspect that is is
due to a memory leak on the PC. It may or not be your application but
something else running on the PC. My solution is to reboot the PC before i
do any operations that may take a lot of memory or that has crashed
previously when I ran the application. Also when you run your macro close
all the unecessary apllications on the PC.
 
S

senthil kumar A

Hi Guys ,
Following errorMessage has been arised for me also .
and from apache Site , i have fixed that error too .
I would like to share this information with you .

Wrong :

for (int i = 0; i < 10000; i++) {
Row row = sheet.createRow(i);
Cell cell = row.createCell((short) 0);
CellStyle style = workbook.createCellStyle();
Font font = workbook.createFont();
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
style.setFont(font);
cell.setCellStyle(style);
}

Correct:

CellStyle style = workbook.createCellStyle();
Font font = workbook.createFont();
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
style.setFont(font);
for (int i = 0; i < 10000; i++) {
Row row = sheet.createRow(i);
Cell cell = row.createCell((short) 0);
cell.setCellStyle(style);
}

Note : LOC of creating fonts is inside the loop , because when you are writing the records to the row. there is no need of keeping the font creation in loop , better move it outside the loop and try it . Sure popup message will not come in case of
large datas populated in the worksheet .
kindly let me know if any .

refURL : http://poi.apache.org/spreadsheet/quick-guide.html



Joe wrote:

We get a similar message in one of our applications.
28-Oct-08

We get a similar message in one of our applications. I suspect that is is
due to a memory leak on the PC. It may or not be your application but
something else running on the PC. My solution is to reboot the PC before i
do any operations that may take a lot of memory or that has crashed
previously when I ran the application. Also when you run your macro close
all the unecessary apllications on the PC

:

Previous Posts In This Thread:

Getting maximum number of fonts have been exceeded error
Hi Team

I am using HSSfWorkbook to create work books using POI API. It has been
working fine. But whenever the date is more and when I try to upload XL sheet
it is giving
Maximum number of fonts have been exceeded error

Any pointers in this regard are appreciated
Thanks in Advanc
SJ

We get a similar message in one of our applications.
We get a similar message in one of our applications. I suspect that is is
due to a memory leak on the PC. It may or not be your application but
something else running on the PC. My solution is to reboot the PC before i
do any operations that may take a lot of memory or that has crashed
previously when I ran the application. Also when you run your macro close
all the unecessary apllications on the PC

:

EggHeadCafe - Software Developer Portal of Choice
Host Winforms App in IE from your web server
http://www.eggheadcafe.com/tutorial...b-78bbd653d184/host-winforms-app-in-ie-f.aspx
 
D

Danny Winbourne

Thanks so much for the tip!
Was going mad trying to solve the issue, and your tip sorted it!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top