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

Free Support Forum - aspose.com

Getting Font not found error while loading Workbook


In my application, I am trying to create a workbook and it’s complaining while trying to find fonts. It’s a new set up on one of our servers, we tried to install fonts into “usr/share/fonts” folder , but still the same error.

Server OS: Red Hat Enterprise Linux Server release 6.5 (Santiago)

Here is the code trying to load:

InputStream fstream = CommonUtils.getInputSreamForClassPathResource(EXCEL_TEMPLATE_ID);
byte[] out = CommonUtils.inputStreamToByteArray(fstream);
ByteArrayInputStream baI = new ByteArrayInputStream(out);
// Instantiating a Workbook object
// Opening the Excel file through the file stream
Workbook workbook = new Workbook(baI);

Error we are getting:

Caused by: java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Cannot find required font defination[Family:Calibri, Style:0]. Please specify font path.
at com.aspose.cells.a.c.m.a(Unknown Source)
at com.aspose.cells.xV.a(Unknown Source)
at com.aspose.cells.xV.a(Unknown Source)
at com.aspose.cells.WorksheetCollection.W(Unknown Source)
at com.aspose.cells.mf.a(Unknown Source)
at com.aspose.cells.mf.b(Unknown Source)
at com.aspose.cells.mk.s(Unknown Source)
at com.aspose.cells.mk.a(Unknown Source)
at com.aspose.cells.mj.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.(Unknown Source)
at com.nielsen.gps.aw.services.exportcommon.style.StyleFactory.createExcelStyleMap(StyleFactory.java:166)
at com.nielsen.gps.aw.services.exportcommon.style.StyleFactory.(StyleFactory.java:103)
... 44 more
Caused by: java.lang.IllegalArgumentException: Cannot find required font defination[Family:Calibri, Style:0]. Please specify font path.
at com.aspose.cells.a.d.co.b(Unknown Source)
... 57 more


As the error denotes, kindly make sure that you have installed all the required fonts (.ttf and .ttc font files, etc.) in your directly first and then set the font directory path at the start of your program (before using other Aspose.Cells APIs) in your code.
Sample code:

//Please adjust the path accordingly (if required).

//Your code goes here.

Moreover, we recommend you to kindly see the documents in the section for your complete reference:

Let us know if you still have any issue.

Thank you.


Thank you for quick response. We have our application stood up in few environments and it’s working fine and in our code we don’t have CellsHelper.setFontDir("/usr/share/fonts"); If we don’t specify any path, does Aspose by default looks into “/usr/share/fonts” folder . But in new environment, it’s complaining about fonts. Wondering how it’s working in our prod env , the code base where I didn’t mention setFontDir .

Aspose Verison: aspose-cells 7.3.2


Well, on a safer side, we always recommend our users to specify fonts directory/path explicitly using CellsHelper.setFontDir() static method on environments (including Linux) other than Windows. So, kindly do explicitly set fonts directory in your code. Also make sure that your underlying fonts directory should be well accessible (you should have sufficient rights to do so.).

Thank you.

Hi Amjad,

I specifies path in code, but still we see the same issue. And infra team verified the permissions
reading it . This is how I set it in the code:

public static final String FONTS_PATH = “/usr/share/fonts”;


Am I missing something?

Also question on how Aspose looks into the given path, doe sit look it up in sub folders under too? In linux I see .ttf in path similar to this :


Or ttf need to be placed directly in “/usr/share/fonts” folder.

Please suggest what else I can try.


Thanks for your posting and using Aspose.Cells.

Aspose.Cells does not look for fonts in sub-directories. So all of your fonts should be inside the directory which you have specified using CellsHelper.setFontDir() method. In your case, all of the fonts should be inside “/usr/share/fonts” directory.


In our existing application, we didn’t mention path and fonts exists in “usr/share/fonts/liberation” folder. I wonder how it’s working and it shows it is looking into sub folders. Same Linux installation on another machine, it’s not working if I don’t specify the path.

We are not preferring the code change to specify the path , as our application already exists in clients, and do not how it impacts existing clients.

Another question, if we don’t specify path, can we know the exact path from where aspose picked the fonts? Is there any util method in aspose to find it ?



Thanks for your posting and using Aspose.Cells.

You may try the following code for your needs, it will give you the list of font directories used by Aspose.Cells.


Workbook wb = new Workbook();
ArrayList fontDirs = CellsHelper.getFontDirs();
for(int i = 0; i < fontDirs.size(); i++)