We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose Error Too many fonts

Hi,
I am using aspose for Java and getting too many fonts error on print.
The segment which I am trying to print has just few words in it.

Please help.

@ruchita93

Thanks for contacting support.

Would you please share a bit more details about the issue like which API you are working with. Also, please share sample code snippet along with sample input document. This would help us testing the scenario in our environment and address it accordingly.

Hi,
We are using aspose-2.5.1-jar for Java.

There is huge data in all the segments.Refere attachment.
Whenever trying to take print it gives Error as Too many fonts.TooManyfontsError.png (22.1 KB)

Code Snipet:

	String w_extension = a_FileName.substring(a_FileName.lastIndexOf(".")+1,a_FileName.length());

	Workbook w_workbook = null;
	String w_finalPath = null;
	java.io.File w_file = null;
	w_file = com.de.base.util.general.FileUtil.getNewFile(w_finalPath); // file path generated
	if (w_file.exists()) {
	//create a copy of the file and open it
	FileUtil.copyFile(w_finalPath, a_FileName);
	w_workbook = new Workbook();
	w_workbook.open(a_FileName);
    addCustomColors(w_workbook);
		
		//First Sheet. Containing the ID and NAME of the item.
		Worksheet w_nameSheet = w_workbook.getWorksheets().getSheet(0);
		printNameSheet(w_nameSheet, w_IDandName, a_Locale);
		//EFormData w_EFData = EFormService.getReducedEFormDataForPrinting(a_EFData);
		//Eformdata are not reduced for printing because during printing of ECR report the genration fails due to the reference of other segments
		//so that we handled same thing at the time of generation of eform report and printing time.
		
		// IGNORE THIS BELOW AS IT PRINTS TABLE DATA ACCORDINGLY FOR SELECTED SEGMENTS
		ArrayList<SegmentData> w_SegmentList = a_EFData.getSegmentList();
		
		
		w_SegmentList = EFormService.getSegmentListSortedByPrintOrder(w_SegmentList);
		
		if (w_SegmentList == null || w_SegmentList.size() <= 0)
			return;
		Object[] w_ecrObj ={ a_Locale,a_EFData,w_userData,a_req,w_CodeandNameArr,w_workbook,m_colorNameVsIdMap,m_ColoursList };
		ECRExcelPrinter w_ecrPrintHelper = new ECRExcelPrinter (w_ecrObj);
		w_ecrPrintHelper.m_ecrPrintTarget = MetricComponentHelper.ECRPRINTTARGET.EXCEL;
		for(int i = 0; i < w_SegmentList.size(); i++)
		{	
			SegmentData w_SegmentData = (SegmentData)w_SegmentList.get(i).clone();
			if (a_SegIdList!=null) 									// To avoid the segments that are not checked on Print.
				//Param CHR120 20th jun 2014. sometimes printable is NULL, so that should be taken as Yes. Only if it No, it should not print.
				if (a_SegIdList.contains(w_SegmentData.getID()) == false || GlobalConstants.NO.equalsIgnoreCase(w_SegmentData.getPrintable()))
					continue;
			if(w_SegmentData.isFieldSegment())
			{
				printFieldSegment(w_workbook,w_SegmentData, a_Locale,a_req);
			}
			else if (MetricComponentHelper.METRIC_COMP_RENDERER_KEY.equals(w_SegmentData.getJSPKey()))
			{
				w_ecrPrintHelper.printECRSegment(w_SegmentData);
			}
		}
		w_workbook.save(a_FileName); // here Exception occures Line 249 in actual code
		
	}

Exception :
com.aspose.cells.CellsException: Too many fonts

at com.aspose.cells.bA.a(Unknown Source)

at com.aspose.cells.bA.a(Unknown Source)

at com.aspose.cells.bA.d(Unknown Source)

at com.aspose.cells.bA.<init>(Unknown Source)

at com.aspose.cells.eQ.<init>(Unknown Source)

at com.aspose.cells.eW.c(Unknown Source)

at com.aspose.cells.eW.b(Unknown Source)

at com.aspose.cells.Workbook.save(Unknown Source)

at com.aspose.cells.Workbook.save(Unknown Source)

at com.de.base.util.app.ExcelPrintHelper.printExcel(ExcelPrintHelper.java:249)

@ruchita93,

Thanks for the sample code segment, screenshot and stack trace.

Well, since you are using some older version of the product (Aspose.Cells for Java v2.5.1), so we cannot evaluate your issue, we are also not sure why you are getting the exception. Neither we can fix any issue (if found) in older versions. The fixes are only based on latest APIs set. So, we recommend you to kindly upgrade to and try our latest version/fix: Aspose.Cells for Java v18.8.x in which we have made more enhancements and fixes regarding rendering modules. You might need to update your code a bit when upgrading to latest APIs accordingly. If you still find the issue with v18.8.x, kindly create a simple Java program (runnable) and provide us here with sample Excel files to reproduce the issue on our end, we will check it soon.