See
https://learn.microsoft.com/en-us/office/open-xml/open-xml-sdk
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am using ClosedXml for my controller to return the excel file as response and it was working in windows local environment. I deployed the code in Kubernates and found the below exceptions in logs and not working. What was the solution to resolve this issue?
"Detail=The type initializer for 'Gdip' threw an exception.,
Exception=System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.\n --->
System.PlatformNotSupportedException: System.Drawing.Common is not supported on non-Windows platforms.
See https://aka.ms/systemdrawingnonwindows for more information.\n
at System.Drawing.LibraryResolver.EnsureRegistered()\n
at System.Drawing.SafeNativeMethods.Gdip.PlatformInitialize()\n
at System.Drawing.SafeNativeMethods.Gdip..cctor()\n --- End of inner exception stack trace ---\n
at System.Drawing.SafeNativeMethods.Gdip.GdipGetGenericFontFamilySansSerif(IntPtr& fontfamily)\n
at System.Drawing.FontFamily.GetGdipGenericSansSerif()\n
at System.Drawing.FontFamily.get_GenericSansSerif()\n
at System.Drawing.Font.CreateFont(String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte charSet, Boolean isVertical)\n
at System.Drawing.Font..ctor(String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont)\n
at System.Drawing.Font..ctor(String familyName, Single emSize, FontStyle style)\n
at ClosedXML.Excel.FontBaseExtensions.GetCachedFont(IXLFontBase fontBase, Dictionary2 fontCache)\n at ClosedXML.Excel.FontBaseExtensions.GetWidth(IXLFontBase fontBase, String text, Dictionary
2 fontCache)\n
at ClosedXML.Excel.XLColumn.AdjustToContents(Int32 startRow, Int32 endRow, Double minWidth, Double maxWidth)\n
at ClosedXML.Excel.XLColumn.AdjustToContents(Int32 startRow, Int32 endRow)\n
at ClosedXML.Excel.XLColumn.AdjustToContents(Int32 startRow)\n at ClosedXML.Excel.XLColumn.AdjustToContents()\n
at ClosedXML.Excel.XLColumns.<>c.<AdjustToContents>b__8_0(XLColumn c)\n
at System.Collections.Generic.List1.ForEach(Action
1 action)\n
at ClosedXML.Excel.XLColumns.AdjustToContents()\n
Thanks
Jo
the error is pretty clear. you must use a windows container, which requires a windows worker node or switch to a library that supports linux.
windows containers in Kubernetes:
Thanks for the update. Is there any open source available for creating Excel in dotnet core webapi with kubernates support?
Thanks in advance.
Jo