public class ExcelUtil extends Object
限定符和类型 | 字段和说明 |
---|---|
protected static org.slf4j.Logger |
log |
构造器和说明 |
---|
ExcelUtil() |
限定符和类型 | 方法和说明 |
---|---|
static void |
createExcel(String sheetName,
List<Map<String,Object>> list,
String[] titles,
String[] fieldNames,
OutputStream output) |
static String[][] |
readExcel(File file,
int ignoreRows)
读取Excel的内容,第一维数组存储的是一行中格列的值,二维数组存储的是多少个行
|
protected static String |
rightTrim(String str)
去掉字符串右边的空格
|
protected static void |
setCellValue(org.apache.poi.hssf.usermodel.HSSFCell cell,
Object value)
设置单元格格式和数据类型转换
|
public static void createExcel(String sheetName, List<Map<String,Object>> list, String[] titles, String[] fieldNames, OutputStream output)
public static String[][] readExcel(File file, int ignoreRows) throws FileNotFoundException, IOException
file
- 读取数据的源ExcelignoreRows
- 读取数据忽略的行数,比喻行头不需要读入 忽略的行数为1FileNotFoundException
- FileNotFoundExceptionIOException
- IOExceptionprotected static void setCellValue(org.apache.poi.hssf.usermodel.HSSFCell cell, Object value)
cell
- cellvalue
- valueCopyright © 2015 jiucai.org. All rights reserved.