ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting maximum number of fonts have been exceeded error (https://www.excelbanter.com/excel-programming/419115-getting-maximum-number-fonts-have-been-exceeded-error.html)

SJ

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 Advance
SJ

joel

Getting maximum number of fonts have been exceeded error
 
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.

"SJ" wrote:

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


senthil kumar A

Maximum number of fonts exceeded in HSSFWorkBook
 
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.

"SJ" wrote:

Previous Posts In This Thread:

On Monday, October 27, 2008 5:42 PM
S wrote:

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 Advance
SJ

On Tuesday, October 28, 2008 6:31 AM
Joe wrote:

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.

"SJ" wrote:

EggHeadCafe - Software Developer Portal of Choice
Host Winforms App in IE from your web server
http://www.eggheadcafe.com/tutorials...p-in-ie-f.aspx

Danny Winbourne

Maximum number of fonts exceeded in HSSFWorkBook
 
Thanks so much for the tip!
Was going mad trying to solve the issue, and your tip sorted it!

On Monday, October 27, 2008 5:42 PM S wrote:


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



On Tuesday, October 28, 2008 6:31 AM Joe wrote:


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.

"SJ" wrote:



On Monday, November 09, 2009 10:21 PM senthil kumar A wrote:


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






All times are GMT +1. The time now is 04:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com