1.先给pom文件中导入Excel4j的依赖包。
<dependency>
<groupId>com.github.crab2died</groupId>
<artifactId>Excel4J</artifactId>
<version>2.1.4-Final2</version>
</dependency>
2.创建Excel的对象实体类。
package com.testfan.excel4j;
import com.github.crab2died.annotation.ExcelField;
public class StudentExcel {
/**
* id
*/
@ExcelField(title = "header1")
private String id;
/**
* 学号
*/
@ExcelField(title = "header2")
private String no;
/**
* 姓名
*/
@ExcelField(title = "header3")
private String name;
/**
* 学院
*/
@ExcelField(title = "header4")
private String college;
/**
* 成绩
*/
@ExcelField(title = "header5")
private float score;
@ExcelField(title = "header6")
private String test;
public String getTest() {
return test;
}
public void setTest(String