Aspose.Cells does not use font installed on the machine



We are using Aspose.Cells for .NET version 17.7 for conversion XLSX files to PDF files and images. We noticed, that Aspose.Cells does not use font installed on the machine.

We are making PDF files using following code:

using (var workBook = new Workbook(inputStream))
    workBook.Save(outputStream, SaveFormat.Pdf);

Steps to reproduce:

Copy Samba.ttf and Asimov.otf from attached ZIP to C:\Windows\Fonts.
Take initial Fonts.xlsx and generate PDF file from it.
Compare fonts in initial XLSX and generated PDF.

Expected results: in both files used the same fonts.
Actual results: in output PDF file used other fonts.

When we generate PDF file using “Save as” menu in MS Excel 2013, in output PDF file initial fonts are used.
Same issue we noticed when converting same XLSX file to image.

In attached ZIP archive:

Samba.ttf and Asimov.otf - fonts;
Fonts.xlsx - initial XLSX file;
Fonts.xlsx.pdf - resulting PDF file, generated by Aspose.Cells.

Roman (128.5 KB)



Thanks for the template file, output file and font files.

After an initial test, I am able to observe the issue as you mentioned by converting your template file to PDF. I first installed your both font files (Samba.ttf and Asimov.otf) and then convert the Excel file to PDF file format. Please note Aspose.Cells does not support .otf font file types properly, so it’s better to convert to .ttf file type. Anyways, I found Aspose.Cells does not use installed fonts (at least it should use Samba.ttf font) on the machine in rendering PDF. I have logged a ticket with an id “CELLSNET-45744” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.



We did evaluate your issue thoroughly.

For the “Asimov.otf” font, I am afraid, as I told you that .otf font files are not supported, so Aspose.Cells cannot render Asimov font.

For the “Samba.ttf” font, there are only few glyphs in the font, so for the text “Samba Font” in your file, only char ‘S’ and char ‘F’ are existed in this font, so we have to substitute font for the whole string by default.
Well, you can use the following code to apply “Samba.ttf” font to char ‘S’ and ‘F’:
Sample code:

    Workbook wb = new Workbook(srcFile);

    PdfSaveOptions opt = new PdfSaveOptions();
    opt.IsFontSubstitutionCharGranularity = true;
    wb.Save(outFile.pdf, opt); 

I have tested and it works fine for Samba font text.