All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.xinjump.easyexcel.helper.EasyExcelHelper Maven / Gradle / Ivy

The newest version!
package com.xinjump.easyexcel.helper;

import com.xinjump.easyexcel.event.AnalysisEventAutoListener;

import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List;

@SuppressWarnings({"rawtypes"})
public class EasyExcelHelper {

    private static final Integer SHEET_NO = 0;

    public static ExcelWriter writer() {
        return new ExcelWriter();
    }

    public static  ExcelWriter singleExcelWriterByHeads(Class clazz, String sheetName, List data) {
        return writer().writeByHeads(clazz, SHEET_NO, sheetName, data);
    }

    public static  ExcelWriter singleExcelWriter(Class clazz, String sheetName, List data) {
        return writer().write(clazz, SHEET_NO, sheetName, data);
    }

    public static  ExcelWriter singleExcelWriter(List> heads, String sheetName, List data) {
        return writer().write(heads, SHEET_NO, sheetName, data);
    }

    public static  ExcelReader read() {
        return new ExcelReader<>();
    }

    public static  T read(String type, InputStream is) {
        return read(type, is, SHEET_NO);
    }

    public static  T read(String type, InputStream is, Integer sheetNo) {
        return read(type, is, sheetNo, null);
    }

    public static  T read(String type, InputStream is, Integer sheetNo, HttpServletResponse response) {
        ExcelReader reader = new ExcelReader<>();
        return reader.read(type, is, sheetNo, response);
    }

    public static  T read(InputStream is, T listener) {
        return read(is, SHEET_NO, listener);
    }

    public static  T read(InputStream is, Integer sheetNo, T listener) {
        ExcelReader reader = new ExcelReader<>();
        return reader.read(is, sheetNo, listener);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy