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

Free Support Forum - aspose.com

Custom font not preserved through image rendering

Hello,

We’re using the SheetRender.ToImage functionality over a worksheet that has some cells formatted with a custom font (the font is already installed in the OS) and the font is not preserved in the image.
Aspose.Cells version 18.8

I’ve attached the input workbook, the output image and the font file.
58560.zip (32.6 KB)
Here’s the sample code I use to reproduce the issue starting from the workbook:

        var workbook = new Workbook("C:\\0ut\\test.xlsx");
        var opt = new ImageOrPrintOptions
        {
            PrintingPage = PrintingPageType.IgnoreBlank,
            ImageFormat = ImageFormat.Png,
            OnePagePerSheet = true,
            OnlyArea = true
        };
        var sh1 = new SheetRender(workbook.Worksheets[0], opt);
        var image = sh1.ToImage(0);
       image.Save("C:\\0ut\\test.png");

As can be seen this does not occur with other fonts.

@adrian.anton,

We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46352 - Custom font not preserved through image rendering

@adrian.anton,

We evaluated your issue further. I am afraid, currently, otf font is not supported. Please convert otf font file to ttf font file using some tool (if possible) and then install the font before using the sample code with template file, it will work fine.

Thank you Amjad,

I confirm it worked after converting it to ttf and reinstalling it overwriting the previous one. C
Is it correct if I conclude that otf files are not supported in general by Aspose and any font that must be used with Aspose must be installed via a ttf file?

@adrian.anton,

Yes, you are right.

@adrian.anton,
otf font is supported in Aspose.Cells for .NET 20.8. Please try our latest release and let us know your feedback.