Aspose.Cells .Net Core 2.1

Hello,

We have a .Net application running in Windows server from several years. We have decided to convert the application to .Net Core 2.1.
I have installed the binaries on Linux Box 16.04 x64 server.
I am getting error ‘The type initializer for ‘Gdip’ threw an exception’ in the line
Workbook excelReportWorkbook = new Workbook(filePath);

Please suggest

Thanks,
Sharanya

@sharanya_ps,

Thanks for your query.

You may install “System.Drawing.Common” and “System.Text.Encoding.CodePages” for .NetStandard20 from NuGet if you refer Aspose.Cells lib manually.

Or you can get Aspose.Cells from NuGet, these will be installed automatically.

Thank you for the response.
I have installed Aspose.Cells (18.10.0) from Nuget
I have System.Drawing.Common.dll version - 4.6.26515.6
and System.Text.Encoding.CodePages version - 4.6.25519.3
in the build package.

Still the error persists.
Any idea?

@sharanya_ps,

Please try following steps to resolve your issue.

  1. Install .NetCore SDK
  2. Install libgdiplus
  3. Copy the font files you need and call FontConfigs.SetFontFolder, please see this article i.e. Configuring Fonts for Rendering Spreadsheets

The installation command to install libgdiplus is as follows

sudo apt-get install libgdiplus
ln -s libgdiplus.so gdiplus.dll 

Let us know your feedback.

Hi,

The above steps could not resolve the issue completely.
As mentioned in Save a PDF under linux (Ubuntu) - #12 by moosbart post,
I had to run the command apt-get install libc6-dev which fixed my problem

Thank you for the support.

-Sharanya

@sharanya_ps,

Good to know that your issue is sorted out by the command. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.