public class ExcelExport extends AbstractExcelUtil
SpreadsheetVersion| Constructor and Description |
|---|
ExcelExport(java.lang.Class<?> cls)
构造函数
|
ExcelExport(int rowAccessWindowSize,
java.lang.Class<?> cls)
构造函数
|
ExcelExport(int rowAccessWindowSize,
java.lang.String sheetname,
java.lang.Class<?> cls,
int... groups)
构造函数
|
ExcelExport(java.lang.String sheetname,
java.lang.Class<?> cls,
int... groups)
构造函数
|
ExcelExport(org.apache.poi.ss.usermodel.Workbook workbook,
java.lang.Integer sheetIndex,
java.lang.Class<?> cls,
int... groups) |
| Modifier and Type | Method and Description |
|---|---|
org.apache.poi.ss.usermodel.Cell |
addCell()
添加一个单元格
|
org.apache.poi.ss.usermodel.Cell |
addCell(org.apache.poi.ss.usermodel.CellStyle cellStyle)
添加一个单元格
|
org.apache.poi.ss.usermodel.Cell |
addCell(int column)
添加一个单元格
|
org.apache.poi.ss.usermodel.Cell |
addCell(int column,
org.apache.poi.ss.usermodel.CellStyle cellStyle)
添加一个单元格
|
void |
addMergedRegion(int firstCol,
int lastCol) |
void |
addMergedRegion(int firstRow,
int lastRow,
int firstCol,
int lastCol) |
org.apache.poi.ss.usermodel.Row |
addRow()
添加一行
|
void |
addValidationData(int firstRow,
int lastRow,
int firstCol,
int lastCol,
java.lang.String[] explicitListValues)
添加数据有效性检查.
|
void |
addValidationData(int firstCol,
int lastCol,
java.lang.String[] explicitListValues)
添加数据有效性检查.
|
void |
createTitle(java.lang.String title) |
void |
createTitle(java.lang.String title,
org.apache.poi.ss.usermodel.CellStyle titleStyle) |
ExcelExport |
dispose()
清理临时文件
|
void |
excludeComment() |
org.apache.poi.ss.usermodel.CellStyle |
getCellStyle(CellStyleType styleType) |
org.apache.poi.ss.usermodel.CellStyle |
getCellStyle(CellStyleType styleType,
org.apache.poi.ss.usermodel.HorizontalAlignment alignment) |
org.apache.poi.ss.usermodel.CellStyle |
getCellStyle(CellStyleType styleType,
org.apache.poi.ss.usermodel.HorizontalAlignment alignment,
boolean border) |
java.lang.String |
getExtension() |
short |
getFormat(java.lang.String cellFormatString) |
org.apache.poi.ss.usermodel.Sheet |
getSheet() |
org.apache.poi.ss.usermodel.Workbook |
getWorkbook() |
void |
includeComment() |
ExcelExport |
initialize(java.lang.Class<?> cls,
int... groups) |
<E> ExcelExport |
setDataList(int startColunm,
java.util.List<E> list)
添加数据(通过annotation.ExportField添加数据)
|
<E> ExcelExport |
setDataList(java.util.List<E> list)
添加数据(通过annotation.ExportField添加数据)
|
void |
setDefaultCellStyle(org.apache.poi.ss.usermodel.CellStyle defaultCellStyle) |
ExcelExport |
wrapText(boolean wrapText) |
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)
输出到文件
|
getCellValueConverter, getExcelFieldDescriptionspublic ExcelExport(java.lang.Class<?> cls)
cls - 实体对象,通过annotation.ExportField获取标题public ExcelExport(int rowAccessWindowSize,
java.lang.Class<?> cls)
rowAccessWindowSize - 行访问窗口大小cls - 实体对象,通过annotation.ExportField获取标题public ExcelExport(java.lang.String sheetname,
java.lang.Class<?> cls,
int... groups)
sheetname - sheetnamecls - 实体对象,通过annotation.ExportField获取标题groups - 导入分组public ExcelExport(org.apache.poi.ss.usermodel.Workbook workbook,
java.lang.Integer sheetIndex,
java.lang.Class<?> cls,
int... groups)
workbook - 工作表sheetIndex - of the sheet number (0-based physical and logical)cls - 实体对象,通过annotation.ExportField获取标题groups - 导入分组public ExcelExport(int rowAccessWindowSize,
java.lang.String sheetname,
java.lang.Class<?> cls,
int... groups)
rowAccessWindowSize - 行访问窗口大小sheetname - sheetnamecls - 实体对象,通过annotation.ExportField获取标题groups - 导入分组public void includeComment()
public void excludeComment()
public org.apache.poi.ss.usermodel.Workbook getWorkbook()
public org.apache.poi.ss.usermodel.Sheet getSheet()
public ExcelExport wrapText(boolean wrapText)
public void setDefaultCellStyle(org.apache.poi.ss.usermodel.CellStyle defaultCellStyle)
public ExcelExport initialize(java.lang.Class<?> cls, int... groups)
cls - 实体对象,通过annotation.ExportField获取标题groups - 导入分组public void createTitle(java.lang.String title)
title - 标题public void createTitle(java.lang.String title,
org.apache.poi.ss.usermodel.CellStyle titleStyle)
title - 标题titleStyle - 标题样式public org.apache.poi.ss.usermodel.CellStyle getCellStyle(CellStyleType styleType)
styleType - 样式类型public org.apache.poi.ss.usermodel.CellStyle getCellStyle(CellStyleType styleType, org.apache.poi.ss.usermodel.HorizontalAlignment alignment)
styleType - 样式类型alignment - 对齐方式public org.apache.poi.ss.usermodel.CellStyle getCellStyle(CellStyleType styleType, org.apache.poi.ss.usermodel.HorizontalAlignment alignment, boolean border)
styleType - 样式类型alignment - 对齐方式border - 是否有边框public void addMergedRegion(int firstCol,
int lastCol)
firstCol - 开始列lastCol - 结束列public void addMergedRegion(int firstRow,
int lastRow,
int firstCol,
int lastCol)
firstRow - 开始行lastRow - 结束行firstCol - 开始列lastCol - 结束列public void addValidationData(int firstCol,
int lastCol,
java.lang.String[] explicitListValues)
firstCol - 开始列lastCol - 结束列explicitListValues - 有效性检查的下拉列表public void addValidationData(int firstRow,
int lastRow,
int firstCol,
int lastCol,
java.lang.String[] explicitListValues)
firstRow - 开始行lastRow - 结束行firstCol - 开始列lastCol - 结束列explicitListValues - 有效性检查的下拉列表public org.apache.poi.ss.usermodel.Cell addCell()
public org.apache.poi.ss.usermodel.Cell addCell(org.apache.poi.ss.usermodel.CellStyle cellStyle)
cellStyle - 样式public org.apache.poi.ss.usermodel.Cell addCell(int column)
column - 列号public org.apache.poi.ss.usermodel.Cell addCell(int column,
org.apache.poi.ss.usermodel.CellStyle cellStyle)
column - 列号cellStyle - 样式public org.apache.poi.ss.usermodel.Row addRow()
public short getFormat(java.lang.String cellFormatString)
public <E> ExcelExport setDataList(java.util.List<E> list)
E - Elist - listpublic <E> ExcelExport setDataList(int startColunm, java.util.List<E> list)
E - Elist - liststartColunm - 起始列public 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 - IOException@NotNull public java.lang.String getExtension()
public ExcelExport writeFile(java.lang.String fileName) throws java.io.IOException
fileName - 输出文件名java.io.IOException - IOExceptionpublic ExcelExport dispose() throws java.io.IOException
java.io.IOException - IOException