alibaba / easyexcel

快速、简洁、解决大文件内存溢出的java处理Excel工具
https://easyexcel.opensource.alibaba.com
Apache License 2.0
31.64k stars 7.46k forks source link

excle填充图片时会报 Can not find 'Converter' support class byte[] #2579

Closed masuoxiaobao closed 6 days ago

masuoxiaobao commented 2 years ago

版本是 3.1.1

//目标excle String fileName = "D:\123-fill.xlsx";

//填充excle中 客户签名字段evaluatorSign 是一张图片 ExcelWriter excelWriter = EasyExcel .write(fileName) .registerWriteHandler(new ImageCellWriteHandler(imageRowIndexs)) .withTemplate(inputStream).build();

Map<String, Object> param = new HashMap<>(); //备注这里的evaluatorSign 是客户签名的一张图片 这里不做具体地址展示 使用XXX代替 getImageFromNetByUrl 返回的类型是byte[] param.put("evaluatorSign", getImageFromNetByUrl("xx")); excelWriter.fill(param, writeSheet); excelWriter.finish();

image image

这样一来就会报错 Can not find 'Converter' support class byte[]

masuoxiaobao commented 2 years ago

找不到对应的类型转换器 就会报错 Can not find 'Converter' support class byte[] ,实际上转换器Map中是有ByteArrayImageConverter这个类的

yxh312154247 commented 1 year ago

请问解决了吗?

hinlokchan commented 1 year ago

I met the same situation.

masuoxiaobao commented 1 year ago

你也遇到了嘛,解决了,在使用前我自定义了转换器

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: yxh312154247 @.> 发送时间: 2023年3月9日 11:49 收件人: alibaba/easyexcel @.> 抄送: masuoxiaobao @.>, Author @.> 主题: Re: [alibaba/easyexcel] excle填充图片时会报 Can not find 'Converter' support class byte[] (Issue #2579)

请问解决了吗?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

hinlokchan commented 1 year ago

WriteSheet writeSheet = EasyExcel.writerSheet().registerConverter(new ByteArrayImageConverter()).build(); I register a DEFAULT ByteArrayImageConverter manually,then it works.

gongxuanzhang commented 1 year ago

尝试使用3.3.1版本 如果仍有问题可以提供完整复现代码

gang4107 commented 1 year ago

我用也遇到同样的问题,我用的版本是3.3.2,也换过之前的版本,依然不行 代码如下 image image 报错信息 image 明明存在byte[]对应的转换器,为什么会匹配不到呢? image

上面说的各位说自定义转换器的方法,我也试了,还是一样的报错信息

gongxuanzhang commented 2 weeks ago

你好,我们发现此Issue已经超过三个月没有活动了,为了更好的帮助您解决问题,我们将在两周后关闭此Issue,如果您仍然有问题,请在两周内内回复此Issue,谢谢!如果您已经解决或者不需要帮助,请忽略此消息。