public class ExcelReader extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
private static String |
DATE_FORMAT |
private static String |
ERROR |
private static DecimalFormat |
fmtDecimal |
private static org.slf4j.Logger |
logger |
| 构造器和说明 |
|---|
ExcelReader() |
| 限定符和类型 | 方法和说明 |
|---|---|
private static String[] |
buildRowValues(org.apache.poi.ss.usermodel.Row hssfRow,
int rowNum,
int cellCount)
组装行数据
|
private static String |
getValue(org.apache.poi.ss.usermodel.Cell cell)
获取Excel单元格的值
|
private static List<String[]> |
mergeSheetDataToList(Map<String,List<String[]>> resultMap)
合并全部sheet数据到list
|
private static List<String[]> |
readXls(InputStream is)
读取Excel 2003-2007版本
|
private static Map<String,List<String[]>> |
readXlsAsMap(InputStream is)
读取Excel 2003-2007版本,各sheet的记录独立返回
|
private static List<String[]> |
readXlsx(InputStream is)
读取 Excel 2010+版本
|
private static Map<String,List<String[]>> |
readXlsxAsMap(InputStream is)
读取Excel 2010+版本,各sheet的记录独立返回
|
static List<String[]> |
toList(File file)
解析Excel文件,将所有sheet下的内容读取合并到一起
|
static List<String[]> |
toList(org.springframework.web.multipart.MultipartFile file)
解析Excel文件,将所有sheet下的内容读取合并到一起
|
static List<String[]> |
toList(String excelFilePath)
解析Excel文件,将所有sheet下的内容读取合并到一起
|
static Map<String,List<String[]>> |
toMap(File excelFile)
解析Excel文件,按sheet读取,key为sheet名,value为sheet中的数据
|
static Map<String,List<String[]>> |
toMap(org.springframework.web.multipart.MultipartFile excelFile)
解析Excel文件,按sheet读取,key为sheet名,value为sheet中的数据
|
static Map<String,List<String[]>> |
toMap(String excelFilePath)
解析Excel文件,按sheet读取,key为sheet名,value为sheet中的数据
|
private static final org.slf4j.Logger logger
private static DecimalFormat fmtDecimal
public static List<String[]> toList(String excelFilePath) throws Exception
excelFilePath - excel文件全路径Exceptionpublic static List<String[]> toList(File file) throws Exception
file - excel文件Exceptionpublic static List<String[]> toList(org.springframework.web.multipart.MultipartFile file) throws Exception
file - 上传文件对象Exceptionpublic static Map<String,List<String[]>> toMap(String excelFilePath) throws Exception
excelFilePath - excel文件全路径Exceptionpublic static Map<String,List<String[]>> toMap(File excelFile) throws Exception
excelFile - excel文件对象Exceptionpublic static Map<String,List<String[]>> toMap(org.springframework.web.multipart.MultipartFile excelFile) throws Exception
excelFile - excel上传文件对象Exceptionprivate static List<String[]> readXlsx(InputStream is) throws Exception
is - Excel文件流Exceptionprivate static Map<String,List<String[]>> readXlsxAsMap(InputStream is) throws Exception
is - Excel文件流Exceptionprivate static List<String[]> readXls(InputStream is) throws Exception
is - Excel文件流Exceptionprivate static List<String[]> mergeSheetDataToList(Map<String,List<String[]>> resultMap)
resultMap - private static Map<String,List<String[]>> readXlsAsMap(InputStream is) throws Exception
is - Excel文件流Exceptionprivate static String[] buildRowValues(org.apache.poi.ss.usermodel.Row hssfRow, int rowNum, int cellCount) throws Exception
hssfRow - rowNum - cellCount - Exceptionprivate static String getValue(org.apache.poi.ss.usermodel.Cell cell)
cell - Copyright © 2018. All rights reserved.