代码参考 https://www.cnblogs.com/bmbm/archive/2011/12/08/2342261.html

效果

用POI 3.17 导出EXECL

 

 用POI 3.17 导出EXECL

 

 

 导入jar包

        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.17</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.17</version>
        </dependency>                

 

用POI 3.17 导出EXECL用POI 3.17 导出EXECL
用POI 3.17 导出EXECL

//准备数据类

package com.wf.zhang.test;
import java.util.Date;

public class Student
{
    private int id;
    private String name;
    private int age;
    private Date birth;

    public Student()
    {
    }

    public Student(int id, String name, int age, Date birth)
    {
        this.id = id;
        this.name = name;
        this.age = age;
        this.birth = birth;
    }

    public int getId()
    {
        return id;
    }

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

    public String getName()
    {
        return name;
    }

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

    public int getAge()
    {
        return age;
    }

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

    public Date getBirth()
    {
        return birth;
    }

    public void setBirth(Date birth)
    {
        this.birth = birth;
    }

}
Student

相关文章: