使用apache poi进行excel导出
文件索引:
1 TestExport.java 主程序
2 student.java 数据bean
3 template.xls 模板文件
以下为例子程序:
TestExport.java
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.jxls.transformer.XLSTransformer;
import org.apache.poi.ss.usermodel.Workbook;
public class TestExport {
public void export() {
List<Student> studentList = new ArrayList<Student>();
Student studentA = new Student();
studentA.setName("tom");
studentA.setAge(20);
Student studentB = new Student();
studentB.setName("John");