public class ExcelExport
extends java.lang.Object
| 构造器和说明 |
|---|
ExcelExport(java.lang.Class<?> cls)
构造函数
|
ExcelExport(java.lang.Class<?> cls,
int type)
构造函数
|
ExcelExport(java.lang.String title,
java.lang.Class<?> cls)
构造函数
|
ExcelExport(java.lang.String title,
java.lang.Class<?> cls,
int type,
int... groups)
构造函数
|
ExcelExport(java.lang.String title,
java.util.List<java.lang.String> headerList)
构造函数
|
ExcelExport(java.lang.String title,
java.lang.String[] headers)
构造函数
|
| 限定符和类型 | 方法和说明 |
|---|---|
org.apache.poi.ss.usermodel.Cell |
addCell(org.apache.poi.ss.usermodel.Row row,
int column,
java.lang.Object val)
添加一个单元格
|
org.apache.poi.ss.usermodel.Cell |
addCell(org.apache.poi.ss.usermodel.Row row,
int column,
java.lang.Object val,
int align,
java.lang.Class<?> fieldType)
添加一个单元格
|
org.apache.poi.ss.usermodel.Row |
addRow()
添加一行
|
ExcelExport |
dispose()
清理临时文件
|
<E> ExcelExport |
setDataList(java.util.List<E> list)
添加数据(通过annotation.ExportField添加数据)
|
ExcelExport |
write(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String fileName)
输出到客户端
|
ExcelExport |
write(java.io.OutputStream os)
输出数据流
|
ExcelExport |
writeFile(java.lang.String fileName)
输出到文件
|
public ExcelExport(java.lang.Class<?> cls)
cls - 实体对象,通过annotation.ExportField获取标题public ExcelExport(java.lang.Class<?> cls,
int type)
cls - 实体对象,通过annotation.ExportField获取标题type - 导出类型(1:导出数据;2:导出模板)public ExcelExport(java.lang.String title,
java.lang.Class<?> cls)
title - 表格标题,传“空值”,表示无标题cls - 实体对象,通过annotation.ExportField获取标题public ExcelExport(java.lang.String title,
java.lang.Class<?> cls,
int type,
int... groups)
title - 表格标题,传“空值”,表示无标题cls - 实体对象,通过annotation.ExportField获取标题type - 导出类型(1:导出数据;2:导出模板)groups - 导入分组public ExcelExport(java.lang.String title,
java.lang.String[] headers)
title - 表格标题,传“空值”,表示无标题headers - 表头数组public ExcelExport(java.lang.String title,
java.util.List<java.lang.String> headerList)
title - 表格标题,传“空值”,表示无标题headerList - 表头列表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,
java.lang.Object val)
row - 添加的行column - 添加列号val - 添加值public org.apache.poi.ss.usermodel.Cell addCell(org.apache.poi.ss.usermodel.Row row,
int column,
java.lang.Object val,
int align,
java.lang.Class<?> fieldType)
row - 添加的行column - 添加列号val - 添加值align - 对齐方式(1:靠左;2:居中;3:靠右)fieldType - fieldTypepublic <E> ExcelExport setDataList(java.util.List<E> list)
E - Elist - listpublic ExcelExport write(java.io.OutputStream os) throws java.io.IOException
os - 输出数据流java.io.IOException - IOExceptionpublic ExcelExport write(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String fileName) throws java.io.IOException
request - requestresponse - responsefileName - 输出文件名java.io.IOException - IOExceptionpublic ExcelExport writeFile(java.lang.String fileName) throws java.io.IOException
fileName - 输出文件名java.io.IOException - IOExceptionpublic ExcelExport dispose()