New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ubuntu 18.04下导出图片失败 #285
Comments
在上述处理完后,还不能解决您的问题,我建议您附加一下错误明细信息. |
您可以通过WSL2进行调试,也可以将这个测试项目上传,我这边看一下。 |
我们测试一下。 |
测试项目地址:https://github.com/zhdwwf/ExcelExportDemo |
https://www.nuget.org/packages/Magicodes.IE.Tools/
|
测试了您的示例代码和mie test,对比了我的代码,发现问题出在图片格式上,如果是png图片,导出成功,jpg图片程序就会卡死,测试代码如下(已同步更新到 https://github.com/zhdwwf/ExcelExportDemo/blob/master/ExcelExportDemo/Program.cs) using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
namespace ExcelExportDemo
{
class Program
{
static void Main(string[] args)
{
string format=args[0];
string img=format.ToLower() == "png" ? "https://gitee.com/magicodes/Magicodes.IE/raw/master/docs/Magicodes.IE.png" : "https://gitee.com/magicodes/Magicodes.IE/raw/master/res/wechat.jpg";
IExporter exporter = new ExcelExporter();
var data = new List<ExportTestDataWithPicture>
{
new ExportTestDataWithPicture
{
Img =img
}
};
var filePath = Path.Combine(System.IO.Directory.GetCurrentDirectory(), "test.xlsx");
var result = exporter.Export("test.xlsx", data).Result;
Console.WriteLine("导出成功!");
}
}
[ExcelExporter(Name = "测试")]
public class ExportTestDataWithPicture
{
[ExportImageField(Width = 50, Height = 120, Alt = "404")]
[ExporterHeader(DisplayName = "图", IsAutoFit = false)]
public string Img { get; set; }
}
}
|
收到,非常感谢,我再试试。 |
确实存在这个问题。 |
在WSL下调试发现JPG图片没能成功取到图片的HorizontalResolution、VerticalResolution导致while循环一直在执行,代码文件:
private void SetPosDefaults(Image image)
{
EditAs = eEditAs.OneCell;
SetPixelWidth(image.Width, image.HorizontalResolution);
SetPixelHeight(image.Height, image.VerticalResolution);
} 此处的HorizontalResolution和VerticalResolution均为0,搜了一下此问题,发现libgdiplus下有issue提到 const float STANDARD_DPI = 96; |
收到,非常感谢,我们尽量尽快处理! |
目前我们发布了 |
感谢您的工作,我升级一下 |
在ubuntu 18.04下使用模板导出图片失败,同一个程序在windows下导出正常,请问ubuntu下是需要专门配置什么吗?已安装 libgdiplus
The text was updated successfully, but these errors were encountered: