Skip to content
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

关于xlsx模版导出图片出错问题 #6925

Closed
q060831 opened this issue Jul 19, 2024 · 2 comments
Closed

关于xlsx模版导出图片出错问题 #6925

q060831 opened this issue Jul 19, 2024 · 2 comments

Comments

@q060831
Copy link

q060831 commented Jul 19, 2024

版本号:3.7.0

问题描述:
导出的数组数据中包含图片时,如果使用xlsx模版(JeecgTemplateExcelView)导出,只要有图片(使用ImageEntity)就会报错org.apache.poi.hssf.usermodel.HSSFClientAnchor cannot be cast to org.apache.poi.xssf.usermodel.XSSFClientAnchor,这是是图片引起,ExcelExportOfTemplateUtil.createImageCell创建图片单元格时是要判断Excel类型的(默认: HSSF),但是跟踪方法并没有设置该值.

推测:在ExcelExportOfTemplateUtil类的parseTemplate方法中添加workbook判断可解决

	private void parseTemplate(Sheet sheet, Map<String, Object> map, boolean colForeach) throws Exception {
		if (workbook instanceof XSSFWorkbook) {
			super.type = ExcelType.XSSF;
		}
                ......
     }
@zhangdaiscott
Copy link
Member

cr

@hoperunChen
Copy link

已修复,待新版本发布。

zhangdaiscott added a commit to jeecgboot/autopoi that referenced this issue Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants