[alibaba/easyexcel]使用.withTemplate(templateFileName)后,文件第一行为空白

2024-05-30 220 views
7

触发场景描述

触发Bug的代码

            .withTemplate(templateFileName)
            .relativeHeadRowIndex(0)
            .head(head())
            .sheet("专利清单")
            .doWrite(datas);
private List<List<String>> head() {
        List<List<String>> headList = new ArrayList<List<String>>();

        List<String> index = new ArrayList<String>();
        List<String> patentName = new ArrayList<String>();
        List<String> inventionType = new ArrayList<String>();
        List<String> departmentName = new ArrayList<String>();
        List<String> inventor = new ArrayList<String>();
        List<String> mainInventorName = new ArrayList<String>();
        List<String> mainInventorTel = new ArrayList<String>();
        List<String> mainInventorPhone = new ArrayList<String>();
        List<String> mainInventorEmail = new ArrayList<String>();
        List<String> technicalField = new ArrayList<String>();
        List<String> standardType = new ArrayList<String>();
        List<String> expeditedFlag = new ArrayList<String>();
        List<String> description = new ArrayList<String>();
        List<String> remark = new ArrayList<String>();

        index.add("动态列表"+ System.currentTimeMillis());
        index.add("序号");

        patentName.add("动态列表"+ System.currentTimeMillis());
        patentName.add("提交姓名");

        inventionType.add("动态列表"+ System.currentTimeMillis());
        inventionType.add("申请类别");

        departmentName.add("动态列表"+ System.currentTimeMillis());
        departmentName.add("上报单位");

        inventor.add("动态列表"+ System.currentTimeMillis());
        inventor.add("发明人");

        mainInventorName.add("动态列表"+ System.currentTimeMillis());
        mainInventorName.add("联系人");

        mainInventorTel.add("动态列表"+ System.currentTimeMillis());
        mainInventorTel.add("联系电话");

        mainInventorPhone.add("动态列表"+ System.currentTimeMillis());
        mainInventorPhone.add("联系手机");

        mainInventorEmail.add("动态列表"+ System.currentTimeMillis());
        mainInventorEmail.add("联系邮件");

        technicalField.add("动态列表"+ System.currentTimeMillis());
        technicalField.add("所属技术领域");

        standardType.add("动态列表"+ System.currentTimeMillis());
        standardType.add("与标准关系");

        expeditedFlag.add("动态列表"+ System.currentTimeMillis());
        expeditedFlag.add("是否加急处理");

        description.add("动态列表"+ System.currentTimeMillis());
        description.add("专利简要说明");

        remark.add("动态列表"+ System.currentTimeMillis());
        remark.add("备注");

        headList.add(index);
        headList.add(patentName);
        headList.add(inventionType);
        headList.add(departmentName);
        headList.add(inventor);
        headList.add(mainInventorName);
        headList.add(mainInventorTel);
        headList.add(mainInventorPhone);
        headList.add(mainInventorEmail);
        headList.add(technicalField);
        headList.add(standardType);
        headList.add(expeditedFlag);
        headList.add(description);
        headList.add(remark);

        return headList;
    }

提示的异常或者没有达到的效果

回答

4

目前不支持空模板。使用模板 模板里面至少有一行。或者不使用模板。

3

目前不支持空模板。使用模板 模板里面至少有一行。或者不使用模板。

使用空模板是为了poi无法操作vba,在模板里内置的vb的代码,然后再由是由easyexcel动态生成导入模板

8

目前不支持空模板。使用模板 模板里面至少有一行。或者不使用模板。

还是有空模板的需求吗,目前没有找到好办法处理空行,会考虑支持吗? 不然只能采用最笨的方法,一步步继承对应的类了 望解答

7

这个 后续我想想办法的吧 这样子的 空模板 读取数据 0开始 然后 一行模板 读取数据0开始 所以没法区分到底有没有数据 后续我加个参数吧。

7

好的,麻烦您了,谢谢您的建议与指点 在2019年10月15日 22:11,Jiaju Zhuang 写道: 这个 后续我想想办法的吧 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

0

这个已经在 2.1.0-beat2里面修复了,直接使用即可。

0

好的,感谢您的耐心指点与建议。麻烦您了 在2019年10月22日 23:25,Jiaju Zhuang 写道: 这个已经在 2.1.0-beat2里面修复了,直接使用即可。 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

8

这个已经在 2.1.0-beat2里面修复了,直接使用即可。 麻烦了,我试试