VahidN / EPPlus.Core

EPPlus.Core is an unofficial port of the EPPlus library to .NET Core
GNU Lesser General Public License v3.0
370 stars 93 forks source link

Calling AutoFitColumns gives Error on Linux but works fine on Windows. #41

Closed paulvanbladel closed 6 years ago

paulvanbladel commented 6 years ago

Thanks for this great library on .net core.

Summary of the issue

Calling AutoFitColumns gives Error on Linux but works fine on Windows.

Z System.TypeInitializationException: The type initializer for 'System.Drawing.GDIPlus' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'gdiplus': The specified module or one of its dependencies could not be found.

Environment

Ubuntu 16.4 and windows 10

The in-use version:
Operating system: 
IDE: (e.g. Visual Studio 2015)

Example code/Steps to reproduce:

paste your core code

Output:

Exception message:
Full Stack trace:
  Connection id "0HLADVPESJ1IA", Request id "0HLADVPESJ1IA:00000004": An unhandled exception was thrown by the application.
2017-12-28T14:22:23.447145539Z System.TypeInitializationException: The type initializer for 'System.Drawing.GDIPlus' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'gdiplus': The specified module or one of its dependencies could not be found.
2017-12-28T14:22:23.447148953Z  (Exception from HRESULT: 0x8007007E)
2017-12-28T14:22:23.447151528Z    at System.Drawing.GDIPlus.GdiplusStartup(UInt64& token, GdiplusStartupInput& input, GdiplusStartupOutput& output)
2017-12-28T14:22:23.447154433Z    at System.Drawing.GDIPlus..cctor()
2017-12-28T14:22:23.447156948Z    --- End of inner exception stack trace ---
2017-12-28T14:22:23.447159412Z    at System.Drawing.GDIPlus.GdipGetGenericFontFamilySansSerif(IntPtr& fontFamily)
2017-12-28T14:22:23.447162155Z    at System.Drawing.FontFamily..ctor(GenericFontFamilies genericFamily)
2017-12-28T14:22:23.447164711Z    at System.Drawing.FontFamily.get_GenericSansSerif()
2017-12-28T14:22:23.447167249Z    at System.Drawing.Font.CreateFont(String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte charSet, Boolean isVertical)
2017-12-28T14:22:23.447169981Z    at OfficeOpenXml.ExcelRangeBase.AutoFitColumns(Double MinimumWidth, Double MaximumWidth)
paulvanbladel commented 6 years ago

In the very latest version (1.5.4) The error message is slightly different: System.TypeInitializationException: The type initializer for 'Gdip' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'libdl': The specified module or one of its dependencies could not be found. (Exception from HRESULT: 0x8007007E) at Interop.Libdl.dlopen(String fileName, Int32 flag) at System.Drawing.SafeNativeMethods.Gdip.LoadNativeLibrary() at System.Drawing.SafeNativeMethods.Gdip..cctor() --- End of inner exception stack trace --- at System.Drawing.SafeNativeMethods.Gdip.GdipGetGenericFontFamilySansSerif(IntPtr& fontfamily) at System.Drawing.FontFamily.GetGdipGenericSansSerif() at System.Drawing.FontFamily.get_GenericSansSerif() at System.Drawing.Font.CreateFont(String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte charSet, Boolean isVertical) at OfficeOpenXml.ExcelRangeBase.AutoFitColumns(Double MinimumWidth, Double MaximumWidth)

VahidN commented 6 years ago
paulvanbladel commented 6 years ago

@VahidN Thanks a lot. Closing the question. Cheers.