public class ExcelFunctions
extends cn.minsin.core.rule.AbstractFunctionRule
导出:builder->sheet->row->cell->export 每一步都不能少
导入:builder->cellValueList 会返回一个复杂类型' Map
第一层Map 是sheet key为sheet的名字
第二层List 是这个sheet里面的行
第三层Map的key为指定下标的值
| 限定符和类型 | 类和说明 |
|---|---|
static class |
ExcelFunctions.ExcelVersion
Excel版本
|
| 限定符和类型 | 字段和说明 |
|---|---|
protected static MutilsExcelProperties |
properties |
| 限定符和类型 | 方法和说明 |
|---|---|
static ExcelFunctions |
builder(ExcelFunctions.ExcelVersion excelVersion)
创建空工作簿
|
static ExcelFunctions |
builder(InputStream in)
加载已经存在的excel文件
|
static ExcelFunctions |
builder(InputStream in,
ExcelFunctions.ExcelVersion excelVersion)
加载已经存在的excel文件 并制定excel的版本
|
static org.apache.poi.ss.usermodel.Workbook |
builderCustomize(InputStream in)
自定义解析Excel 在某些情况,通用的Excel解析是不会满足条件的,那么这个方法会提供了将Inputsteam转换成workbook
|
ExcelFunctions |
cell(int index,
Object value) |
static void |
error(javax.servlet.http.HttpServletResponse resp,
String message,
Exception error) |
void |
export(javax.servlet.http.HttpServletResponse resp,
String fileName,
boolean isUTF8)
导出文件到浏览器
|
void |
export(String filename)
D://upload/aaa
|
static String |
getCellRealValue(org.apache.poi.ss.usermodel.Cell cell)
获取CellValue
|
Map<String,ExcelRowModel> |
getCellValueList(String[] sheetNames,
int startRowIndex,
int[] cellIndex)
获取指定的Excel中的值
|
static InputStream |
getExcelTemplate(String excelName)
获取Excel文件
|
ExcelFunctions.ExcelVersion |
getVersion()
获取当前excel的Version
|
org.apache.poi.ss.usermodel.Workbook |
getWorkBook() |
ExcelFunctions |
row(int rowNum) |
ExcelFunctions |
sheet(int sheetnum) |
ExcelFunctions |
sheet(int sheetNum,
String name) |
ExcelFunctions |
version(ExcelFunctions.ExcelVersion excelVersion)
设置excel的版本
|
protected static final MutilsExcelProperties properties
public static ExcelFunctions builder(ExcelFunctions.ExcelVersion excelVersion)
excelVersion - public static ExcelFunctions builder(InputStream in) throws org.apache.poi.EncryptedDocumentException, IOException
in - IOExceptionorg.apache.poi.EncryptedDocumentExceptionpublic static ExcelFunctions builder(InputStream in, ExcelFunctions.ExcelVersion excelVersion) throws Exception
in - excelVersion - Exceptionpublic static org.apache.poi.ss.usermodel.Workbook builderCustomize(InputStream in) throws Exception
in - Exceptionpublic ExcelFunctions version(ExcelFunctions.ExcelVersion excelVersion)
excelVersion - public org.apache.poi.ss.usermodel.Workbook getWorkBook()
public ExcelFunctions.ExcelVersion getVersion()
public void export(String filename) throws IOException
filename - 无后缀的文件名 2018年10月11日IOExceptionpublic void export(javax.servlet.http.HttpServletResponse resp,
String fileName,
boolean isUTF8)
resp - fileName - 无后缀的文件名 2018年10月11日public ExcelFunctions sheet(int sheetnum)
public ExcelFunctions sheet(int sheetNum, String name)
public ExcelFunctions row(int rowNum)
public ExcelFunctions cell(int index, Object value)
public Map<String,ExcelRowModel> getCellValueList(String[] sheetNames, int startRowIndex, int[] cellIndex)
sheetNames - 需要获取的sheet的名字startRowIndex - 开始读取的行下标cellIndex - 需要获取的cell下标数组public static String getCellRealValue(org.apache.poi.ss.usermodel.Cell cell)
cell - public static void error(javax.servlet.http.HttpServletResponse resp,
String message,
Exception error)
public static InputStream getExcelTemplate(String excelName)
excelName - Copyright © 2019. All rights reserved.