由于windows加载本地文件和linux加载本地文件有区别,所以在加载本地文件时,使用方法有所不同
//此方式是linux使用加载模板文件
InputStream in = ExcelUtils.class.getClassLoader().getResourceAsStream("classpath:templates/userTemp.xlsx");
XSSFWorkbook wb = new XSSFWorkbook ( in );
//此方式是windows使用加载模板文件
File file = ResourceUtils.getFile ( "classpath:templates/userTemp.xlsx" );
FileInputStream stream = new FileInputStream ( file );
XSSFWorkbook wb = new XSSFWorkbook ( stream );
linux导出excel加载模板文件错误
最新推荐文章于 2024-03-19 16:21:09 发布