Search code examples
c#spreadsheetgear

C# SpreadsheetGear AutoFit failed to run on linux with error "System.Drawing.Common is not supported on this platform."


I am trying to move my project from Windows to Linux. Everything works fine, but I get an error:

C# SpreadsheetGear AutoFit failed to run on linux with error "System.Drawing.Common is not supported on this platform."

when I try to execute worksheet.UsedRange.Columns.AutoFit() using C# on Linux. I have tried both SpreadsheetGear2017 and SpreadsheetGear2023 with no luck.

Any suggestions on how to solve this? Thanks.


Solution

  • The SpreadsheetGear for .NET Framework product (any version) is not supported on Linux, so it's not surprising to hear you are running into issues such as this. If you need to use SpreadsheetGear on a Linux machine, you will need to use the SpreadsheetGear Engine for .NET product, which is distributed as the "SpreadsheetGear" NuGet package:

    https://www.nuget.org/packages/SpreadsheetGear

    This product targets .NET 6 and .NET Standard 2.0 and so will be able to run on Linux (or anywhere else where .NET 6 or .NET Standard 2.0 are supported).