阿里easyexcel教程

1、引入依赖


      com.alibaba
      easyexcel
      2.1.6
    

 

2、ExcelUtil

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.read.listener.ReadListener;

import java.util.List;


public class ExcelUtil {

    public static void readToListener(String excelPath, Class clazz, ReadListener readListener){
        EasyExcel.read(excelPath, clazz, readListener).sheet().doRead();
    }

    public static void write(String excelPath, Class clazz, List data,String sheetName){
        EasyExcel.write(excelPath, clazz).sheet(sheetName).doWrite(data);
    }

    public static void writeDynamicHead(String excelPath,List> head,String sheetName,List> data) {

        EasyExcel.write(excelPath).head(head).sheet(sheetName).doWrite(data);
    }


}

 

你可能感兴趣的:(java,excel,阿里巴巴,java)