首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用jett导出到Excel时出错500

用jett导出到Excel时出错500
EN

Stack Overflow用户
提问于 2022-04-22 03:52:07
回答 1查看 90关注 0票数 0

当我用jett导出Excel时,我会得到这个错误。因为这个我损失了几天时间

Maven:

代码语言:javascript
复制
    <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>5.0.0</version>
    </dependency>

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>5.0.0</version>
    </dependency>

    <dependency>
        <groupId>com.github.ozlerhakan</groupId>
        <artifactId>poiji</artifactId>
        <version>3.1.7</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/net.sf.jett/jett-core -->
    <dependency>
        <groupId>net.sf.jett</groupId>
        <artifactId>jett-core</artifactId>
        <version>0.11.0</version>
    </dependency>

代码:

代码语言:javascript
复制
public <S, T> void exportToExecl(HttpServletResponse response, List<S> listError, String template) {

    try {
        Map<String, Object> beans = new HashMap<>();
        beans.put("excel",listError);

        Resource resource = new ClassPathResource("/templates/" + template);
        InputStream fileIn =new BufferedInputStream(resource.getInputStream());

        ExcelTransformer transformer = new ExcelTransformer();
        Workbook workbook = transformer.transform(fileIn, beans);

        response.setHeader("Content-Disposition", "attachment; filename=Erorr_" + template);
        ServletOutputStream out = response.getOutputStream();

        workbook.write(out);
        out.flush();
        out.close();

    } catch (IOException e) {
        throw new InfoCityException(e.getMessage());
    } catch (InvalidFormatException e) {
        throw new InfoCityException(e.getMessage());
    }
}

消息错误:

代码语言:javascript
复制
{
    "timestamp": "2022-04-22T03:44:01.120+00:00",
    "status": 500,
    "error": "Internal Server Error",
    "message": "'int org.apache.poi.ss.usermodel.Cell.getCellType()'"
}
EN

回答 1

Stack Overflow用户

发布于 2022-04-24 02:00:37

正如您在评论中已经提到的,问题在于您使用的是ApachePOI5.0,而JETT 0.11.0需要运行POI 3.14。

为了支持最新的POI版本,在JETT论坛上进行了讨论,但据我所知,什么也没有发生。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71963298

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档