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

Free Support Forum - aspose.com

Applying custom style on entire row in Excel worksheet with Aspose.Cells for .NET API in C#


We recently bought the Aspose.Cells library for the specific purpose of exporting some data (charts and formulas included) from Excel files to PDF files. This is working great on Windows machines, but the PDF looks awful (and doesn’t update the formulas) on unix machines.
Could you offer some more details? Is this library dependent on an operating system or having Microsoft Excel installed?


1 Like


Thanks for providing us details.

Aspose.Cells renders the Excel files to PDF format in the same way on both Windows and Linux environments. However, we recommend you should try to call Workbook.CalculateFormula() method before rendering to PDF file format. If your spreadsheet contains formulas, it is best to call Workbook.CalculateFormula() just before rendering the spreadsheet to PDF format. Doing so will ensure that the formula dependent values are recalculated, and the correct values are rendered in the PDF.

Furthermore, if you also find text/data (formatting) rendering issue, this might be due missing fonts issue, so you can do the needful to cope with it on Linux machine, see the document for your reference:

Let us know if you still find any issue.

Thank you for the quick reply.
One thing that I’ve forgot to mention is the fact that we are using the Java version of the library (but I don’t think that should make any difference from the .NET one).
We are going to look into the font issue and will get back to you on it, but in the meantime I was just wondering if also the margins and I want to say zoom level of the PDF could be influenced by these missing fonts? On Windows again the PDF is generated spot on, while on Linux the last 2 columns for example are moved to a second page. Also on Linux the top title is displayed only the bottom half. Do we need to play around with the PDFSaveOptions a little more for Linux?


Yes, page margins, other formatting and aspects may be affected by missing fonts on Linux. So, kindly first make sure that all the fonts (.ttf files) used in the Workbook are installed on Linux machine. Also, configure and set fonts folder (in code) at the start and before using/rendering to PDF file format. If you still find the issue, kindly do provide your template file, output file and font files to show the issue, we will check it soon.

TestData.zip (134.5 KB)
We have tested with some default fonts, but with no luck.
I have attached the TestData zip file which contains the input Excel File and 3 output PDFs: one on Windows, one on Ubuntu with the UbuntuMono Font which is system default and one on Ubuntu which has a font set in the source code and is being loaded as per the documentation.
Even when using the UbuntuMono system default font, some of the PDF labels are not in place. Could you please advise?


Thanks for the template file and sample PDF documents.

For your information, in Excel to PDF rendering, it is necessary that the fonts (.ttf files) used in the spreadsheet should be available in the operating system’s default or specified fonts directory.

Please note, regarding font substitutions, by default, Aspose.Cells checks the workbook’s default font to see if it can be used to show the text properly. If not, Aspose.Cells will search all the fonts in the specified folders. Aspose.Cells APIs also provide the ability to specify the substitute font for rendering purposes. But this mechanism is not always helpful as it might deteriorate the formattings. For your information, every font has its own chars’ glyph and cannot be matched with other font.

To cope with your issue, as I told you earlier, please install the underlying fonts used in the workbook (in your case, please install Arial and Calibri font files (.ttf files)) on linux, it will work as expected (same as the output on Windows).