项目依赖文件配置

  1. 源码暂时未发布到maven中心仓库,优先使用打好包的文件进行使用<br />**jar 文件[growth-excel.jar](https://www.yuque.com/attachments/yuque/0/2021/jar/10389960/1616937537271-911457dd-e465-415a-b367-7c8e76b35dfd.jar?_lake_card=%7B%22uid%22%3A%221616937520314-0%22%2C%22src%22%3A%22https%3A%2F%2Fwww.yuque.com%2Fattachments%2Fyuque%2F0%2F2021%2Fjar%2F10389960%2F1616937537271-911457dd-e465-415a-b367-7c8e76b35dfd.jar%22%2C%22name%22%3A%22growth-excel.jar%22%2C%22size%22%3A29830152%2C%22type%22%3A%22%22%2C%22ext%22%3A%22jar%22%2C%22progress%22%3A%7B%22percent%22%3A99%7D%2C%22status%22%3A%22done%22%2C%22percent%22%3A0%2C%22id%22%3A%22F3MUG%22%2C%22card%22%3A%22file%22%7D)**

jar包maven配置

        <dependency>
            <groupId>cn.zzhardy</groupId>
            <artifactId>growth-excel</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/lib/growth-excel.jar</systemPath>
        </dependency>

jar包文件地址

image.png

该文档所有测试地址存放地址

growth-excel-example 测试源码地址

最简单的测试例子

注意:
当前测试基于lombok和junit环境

新建Model

import cn.zzhardy.annotation.Excel;
import lombok.Setter;

public class Example {
    @Setter
    @Excel(name = "表格标题一", sort = 1)
    private String titleOne;

    @Setter
    @Excel(name = "表格标题二", sort = 2)
    private String titleTwo;

    @Setter
    @Excel(name = "表格标题三", sort = 1)
    private String titleThree;
}

新建测试类数据

@Test
    public void excelTest() {
        List<Example> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            Example example = new Example();
            example.setTitleOne("标题一 - " + i);
            example.setTitleTwo("标题二 - " + i);
            example.setTitleThree("标题三 - " + i);
            list.add(example);
        }
        ExcelCenter<Example> util = new ExcelCenter<>(Example.class);
        util.exportExcel(list, "Excel生成案例");
    }

效果图

第一个测试用例.png