dotnetcore / Magicodes.IE

Import and export general library, support Dto import and export, template export, fancy export and dynamic export, support Excel, Csv, Word, Pdf and Html.
http://docs.dotnet-china.com/Magicodes.IE
MIT License
2.1k stars 481 forks source link

magicodes.ie.excel.aspnetcore 2.7.4.5在WindowServier 2012R2下运行The type initializer for 'SkiaSharp.SKFontStyle' threw an exception. #548

Open Sheldon-NULL opened 9 months ago

Sheldon-NULL commented 9 months ago

Expected behaviour

生成Excel文件的时候报错

463 #468 报错信息应该是一样的,但是服务器环境是WinServer;

ps:本地window10环境没有问题

package versions

Example: magicodes.ie.excel.aspnetcore 2.7.4.5

StackMsg:

错误消息: The type initializer for 'SkiaSharp.SKFontStyle' threw an exception. 堆栈信息: at OfficeOpenXml.ExcelRangeBase.GetAvailableFont(String text) at OfficeOpenXml.ExcelRangeBase.AutoFitColumns(Double minimumWidth, Double maximumWidth) at OfficeOpenXml.ExcelRangeBase.AutoFitColumns(Double MinimumWidth) at OfficeOpenXml.ExcelRangeBase.AutoFitColumns() at Magicodes.ExporterAndImporter.Excel.Utility.ExportHelper1.AddHeaderAndStyles() at Magicodes.ExporterAndImporter.Excel.Utility.ExportHelper1.Export(ICollection1 dataItems) at Magicodes.ExporterAndImporter.Excel.ExcelExporter.ExportAsByteArray[T](ICollection1 dataItems)

Sheldon-NULL commented 9 months ago

单独安装SkiaSharp.NativeAssets.Win32,没有作用。 升级到magicodes.ie.excel.aspnetcore 2.7.4.5.1 ,没有作用

hueifeng commented 9 months ago

windows server哪个版本?

Sheldon-NULL commented 9 months ago

image

Sheldon-NULL commented 9 months ago

@hueifeng image DataCenter的版本可以,很奇怪。是包的兼容性问题吗

hueifeng commented 9 months ago

@Sheldon-NULL 是不是缺少runtimes文件?我试了下,并没有复现出来呢,可以创建一个最小化的Demo吗?https://github.com/dotnetcore/Magicodes.IE/tree/master/src/Magicodes.IE.Tools

Sheldon-NULL commented 8 months ago

少哪个runtimes文件?libskiasharp这个dll也有的。不好复现,自己的云测试服务器都没复现出来,就是在生产环境出问题了