lf-execl-easy

excel 简易使用

License

License

GroupId

GroupId

com.github.a982338665
ArtifactId

ArtifactId

lf-execl-easy
Last Version

Last Version

1.0.1-RELEASE
Release Date

Release Date

Type

Type

jar
Description

Description

lf-execl-easy
excel 简易使用
Project URL

Project URL

https://github.com/a982338665/lf-execl-easy
Source Code Management

Source Code Management

https://github.com/a982338665/lf-execl-easy

Download lf-execl-easy

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.a982338665/lf-execl-easy/ -->
<dependency>
    <groupId>com.github.a982338665</groupId>
    <artifactId>lf-execl-easy</artifactId>
    <version>1.0.1-RELEASE</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.a982338665/lf-execl-easy/
implementation 'com.github.a982338665:lf-execl-easy:1.0.1-RELEASE'
// https://jarcasting.com/artifacts/com.github.a982338665/lf-execl-easy/
implementation ("com.github.a982338665:lf-execl-easy:1.0.1-RELEASE")
'com.github.a982338665:lf-execl-easy:jar:1.0.1-RELEASE'
<dependency org="com.github.a982338665" name="lf-execl-easy" rev="1.0.1-RELEASE">
  <artifact name="lf-execl-easy" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.a982338665', module='lf-execl-easy', version='1.0.1-RELEASE')
)
libraryDependencies += "com.github.a982338665" % "lf-execl-easy" % "1.0.1-RELEASE"
[com.github.a982338665/lf-execl-easy "1.0.1-RELEASE"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

lf-execl-easy

excel的简易使用

1.测试用例:

package com.github.lfexecleasy.test;

import com.github.lfexecleasy.anno.LFColume;

import java.util.Date;

/**
 * @author : Mr huangye
 * URL : CSDN 皇夜_
 * createTime : 2020/5/29 16:19
 */
public class TestDept {

    @LFColume("id")
    private String id;
    @LFColume("名称")
    private String deptName;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
}

package com.github.lfexecleasy.test;

import com.github.lfexecleasy.anno.LFColume;

import java.util.Date;

/**
 * @author : Mr huangye
 * URL : CSDN 皇夜_
 * createTime : 2020/5/29 16:19
 */
public class TestUser {

    @LFColume("id")
    private String id;
    @LFColume("名称")
    private String name;
    @LFColume("年龄@1-1岁 2-2岁")
    private String age;
    @LFColume("时间")
    private Date time;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }
}



public static void main(String[] args) {

        //数据准备
        List<TestUser> testUsers = new ArrayList<>();
        for (int i = 0; i < 2; i++) {
            TestUser testUser = new TestUser();
            testUser.setAge("18");
            testUser.setId("12");
            testUser.setName("name");
            testUser.setTime(new Date());
            testUsers.add(testUser);
        }
        for (int i = 0; i < 1; i++) {
            TestUser testUser = new TestUser();
            testUser.setAge("1");
            testUser.setId("12");
            testUser.setName("name");
            testUser.setTime(new Date());
            testUsers.add(testUser);
        }
        //数据准备
        List<TestDept> testDept = new ArrayList<>();
        for (int i = 0; i < 2; i++) {
            TestDept testUser = new TestDept();
            testUser.setId("12");
            testUser.setDeptName("部门+" + i);
            testDept.add(testUser);
        }
 
        //导出全部
        ExportDataBase all1 = new ExportDataALL("sheet1", testUsers, TestUser.class);
        ExportDataBase all2 = new ExportDataALL("sheet2", testUsers, TestUser.class);
        ExportDataBase all3 = new ExportDataPart("sheet3", new String[]{"id", "部门名称"}, new String[]{"id", "deptName"}, testDept);

        all1.setExcelRuleInfo(new ExcelRuleInfo("hhh"));

        String fileName = "./TestOutputExcel.xlsx";
        ExportExcelUtils exportExcelUtils = new ExportExcelUtils();
        String s = exportExcelUtils.makeTable(all1, all2, all3);
//        System.err.println(s);
        exportExcelUtils.outPutFile(fileName, s);
        //多sheet导出
//        export(all1, all2);

    }

Versions

Version
1.0.1-RELEASE
1.0.0-RELEASE