public class ExportExcel extends Object
| 构造器和说明 |
|---|
ExportExcel(String title,
Class<?> cls)
构造函数
|
ExportExcel(String title,
Class<?> cls,
int type,
int... groups)
构造函数
|
ExportExcel(String title,
List<ExcelHeader> headerList)
构造函数
|
ExportExcel(String title,
String[] headers)
构造函数
|
| 限定符和类型 | 方法和说明 |
|---|---|
org.apache.poi.ss.usermodel.Cell |
addCell(org.apache.poi.ss.usermodel.Row row,
int column,
Object val)
添加一个单元格
|
org.apache.poi.ss.usermodel.Cell |
addCell(org.apache.poi.ss.usermodel.Row row,
int column,
Object val,
int align,
Class<?> fieldType)
添加一个单元格
|
org.apache.poi.ss.usermodel.Row |
addRow()
添加一行
|
ExportExcel |
dispose()
清理临时文件
|
static void |
downLoadZip(javax.servlet.http.HttpServletResponse response,
List<String> filePath,
String fileName)
下载多文件 打包文件可供下载 FIXME
|
static ExportExcel |
exportExcelForMoreSheet(List<String> title,
List<List<?>> dataList)
导出函数,多sheet页导出
|
List<ExcelHeader> |
getHeaderList(Class<?> cls,
int type,
int... groups) |
<E> ExportExcel |
setDataList(List<E> list)
添加数据(通过annotation.ExportField添加数据)
|
<E> ExportExcel |
setDataListForMoreSheet(String title,
List<E> list,
boolean isNewSheet,
List<ExcelHeader> headerList)
添加数据(通过annotation.ExportField添加数据),方便添加新的sheet页,isNewSheet = true 新加新sheet
|
ExportExcel |
write(javax.servlet.http.HttpServletResponse response,
String fileName)
输出到客户端
|
ExportExcel |
write(OutputStream os)
输出数据流
|
ExportExcel |
writeFile(String name)
输出到文件
|
static void |
zipFile(File inputFile,
ZipOutputStream zipoutputStream) |
public ExportExcel(String title, Class<?> cls)
title - 表格标题,传“空值”,表示无标题cls - 实体对象,通过annotation.ExportField获取标题public ExportExcel(String title, Class<?> cls, int type, int... groups)
title - 表格标题,传“空值”,表示无标题cls - 实体对象,通过annotation.ExportField获取标题type - 导出类型(1:导出数据;2:导出模板)groups - 导入分组public ExportExcel(String title, String[] headers)
title - 表格标题,传“空值”,表示无标题headers - 表头数组public ExportExcel(String title, List<ExcelHeader> headerList)
title - 表格标题,传“空值”,表示无标题headerList - 表头列表public static ExportExcel exportExcelForMoreSheet(List<String> title, List<List<?>> dataList)
public List<ExcelHeader> getHeaderList(Class<?> cls, int type, int... groups)
public org.apache.poi.ss.usermodel.Row addRow()
public org.apache.poi.ss.usermodel.Cell addCell(org.apache.poi.ss.usermodel.Row row,
int column,
Object val)
row - 添加的行column - 添加列号val - 添加值public org.apache.poi.ss.usermodel.Cell addCell(org.apache.poi.ss.usermodel.Row row,
int column,
Object val,
int align,
Class<?> fieldType)
row - 添加的行column - 添加列号val - 添加值align - 对齐方式(1:靠左;2:居中;3:靠右)public <E> ExportExcel setDataList(List<E> list)
public <E> ExportExcel setDataListForMoreSheet(String title, List<E> list, boolean isNewSheet, List<ExcelHeader> headerList)
public ExportExcel write(OutputStream os) throws IOException
os - 输出数据流IOExceptionpublic ExportExcel write(javax.servlet.http.HttpServletResponse response, String fileName) throws IOException
fileName - 输出文件名IOExceptionpublic ExportExcel writeFile(String name) throws FileNotFoundException, IOException
name - 输出文件名FileNotFoundExceptionIOExceptionpublic ExportExcel dispose()
public static void downLoadZip(javax.servlet.http.HttpServletResponse response,
List<String> filePath,
String fileName)
public static void zipFile(File inputFile, ZipOutputStream zipoutputStream)
Copyright © 2022. All rights reserved.