Free Support Forum - aspose.com

Aspose.Cells Mac problem

When the new Workbook (path) is reported, an exception was thrown by the type initializer for System.Drawing.GDIPlus Why is this caused, the file path is correct.
Excel file is a resource on Windows

@zhangdong,
I have tried a sample project on Mac and found it working fine. 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.

If it does not work please try the following steps:

  1. Install .NetCore SDK
  2. Install libgdiplus

The installation command to install libgdiplus is as follows

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

If it does not resolve your issue, try to install the following:
apt-get install libc6-dev

If all these steps do not resolve your issue, please share your sample project with us for our testing. Here the sample project is attached for your reference which is working fine here on Mac.
TestProject1.zip (4.7 MB)

Hello, there is still a problem on the mac, I saw your demo, new Workbook () is no problem, there will be no errors, but my new Workbook (filepath) will report an error, the error is: An Exception was thrown by the type initializer for System.Drawing.KnownColors

I use the version of net3.5_ClientProfile, I am manually referencing Aspose.Cells, the programming language is C#.

@zhangdong,
Could you please share your template Excel file which you are using in your testing. It will help us to observe the problem and provide assistance accordingly. Also if possible, please share your simplified running console application based solution which contains only necessary Aspose.Cells code for our reference.

OPDynamicAtmosphere.zip (12.8 KB)

Hello, this is our Excel table, new WorkBook (pathfile) will report an error

@zhangdong,
I have tried different sample projects like .NETCore and .NET with net3.5_ClientProfile using Visual Studio for Mac. Both the projects work fine and your template file is loaded successfully without any exception in Mac OS. Could you please share your complete sample solution containing the Aspose.Cells related code only? We will use this solution to reproduce the issue here.

I am using macOS Catalina Version 10.15.1, Visual Studio for MAC (Community) Version 8.3.5 (build 13) and Aspose.Cells for .NET 19.10.

I am using monoDevelop, is it still because of problems with the environment configuration?

@zhangdong,
Well I have tried this scenario using mono framework also and performed this test without using any IDE. The sample program is compiled and executed from the Mac OS terminal using the csc and mono commands respectively. This template file is loaded successfully and its first sheet name is read successfully (for testing purpose). It seems that your environment is not configured properly. You may please try this scenario on some other system and share the feedback as we are not able to reproduce this issue here.

Thank you very much for your support and answers. I solved it. The last problem is the problem of environment configuration. I installed a visual studio mac and the problem is solved. Before I manually added Aspose.Cells.dll to our project, Windows is correct, MAC will not work, so I still want to ask, what is the manual configuration tutorial?

@zhangdong,
I have performed simple steps where a C# program is compiled and executed using the following commands in the Mac OS terminal:

csc -r:Aspose.Cells.dll,System.Drawing.Common.dll  hello.cs
mono hello.exe

Following is the sample program:

using System;
using Aspose.Cells;
public class HelloWorld
{
    public static void Main(string[] args)
    {
            Workbook workbook = new Workbook(@"OPDynamicAtmosphere.xlsx");
            Console.WriteLine(workbook.Worksheets[0].Name);    
    }
}

Other than this no special configuration is done except the commands shared earlier in this thread. You may try this and if some issue is there, share the details with us. We will try to provide assistance at the earliest.