Closed paulvanbladel closed 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)
System.Drawing.Common
library. It's in the preview phase right now. To fix Unable to load DLL 'libdl'
error, you should
symlink /lib64/libdl.so.2 to /lib64/libdl.so
CoreCompat.System.Drawing.v2
Install-Package EPPlus.Core -Version 1.5.2
Also you need to install libgdiplus
too.
For Ubuntu 16.04 and above:
apt-get install libgdiplus
cd /usr/lib
ln -s libgdiplus.so gdiplus.dll
@VahidN Thanks a lot. Closing the question. Cheers.
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
Example code/Steps to reproduce:
Output: