public class XlsxUtil extends Object
| 构造器和说明 |
|---|
XlsxUtil()
构造函数
|
XlsxUtil(InputStream inp)
构造函数
|
XlsxUtil(String xFile)
构造函数
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
cloneBlankRow(int curRow,
int oriRow)
克隆空白行
|
void |
cloneMergedRegion(int curRow,
int oriRow)
设置合并单元格
|
static void |
close(Closeable... closeables)
关闭对象
|
String |
getCellValue(org.apache.poi.ss.usermodel.Cell cell)
获取单元格的数据
|
String |
getCellValue(int rowNo,
int colNo)
根据行和列的索引获取单元格的数据
|
float[] |
getColWidth(int maxColNum)
获取指定列的列宽
|
List<Map<String,String>> |
getDataByRow(int startRow,
Map<String,Integer> header)
逐行读取数据
|
String |
getFile() |
int |
getMaxColNum(int rowNum)
获取Excel页的最大列数
|
int |
getMaxRowNum()
获取最大行号
|
org.apache.poi.ss.usermodel.Row |
getRow(int i) |
org.apache.poi.ss.usermodel.Sheet |
getSheet() |
org.apache.poi.ss.usermodel.Workbook |
getWorkbook() |
void |
initWorkbook()
初始化
|
void |
initWorkbook(InputStream inp)
初始化
|
void |
newWorkbook()
初始化
|
static List<Map<String,String>> |
readExcel(org.springframework.web.multipart.MultipartFile file,
int startRow,
Map<String,Integer> header)
从前台导入的Excel数据
|
List<Map<String,String>> |
readExcel(String file,
int startRow,
Map<String,Integer> header)
读取Excel文件中的数据
|
void |
removeExcelRow(int curRow,
int rows)
从Excel当前行(curRow)开始删除多行(rows)
|
void |
setCellValue(int rowNo,
int colNo,
String value)
根据行和列的索引设置单元格的数据
|
void |
shiftRows(int startRow,
int endRow,
int rows)
复制行信息
|
void |
writeExcel(OutputStream out)
把Workbook缓存数据写入Excel文件
|
void |
writeExcel(String file)
把Workbook缓存数据写入Excel文件
|
public XlsxUtil()
public XlsxUtil(String xFile)
public XlsxUtil(InputStream inp)
public void initWorkbook()
public void initWorkbook(InputStream inp)
public void newWorkbook()
public List<Map<String,String>> readExcel(String file, int startRow, Map<String,Integer> header)
public void writeExcel(String file)
public void writeExcel(OutputStream out) throws IOException
IOExceptionpublic static List<Map<String,String>> readExcel(org.springframework.web.multipart.MultipartFile file, int startRow, Map<String,Integer> header)
file - startRow - header - public static void close(Closeable... closeables)
public void shiftRows(int startRow,
int endRow,
int rows)
public void cloneBlankRow(int curRow,
int oriRow)
public void cloneMergedRegion(int curRow,
int oriRow)
public void removeExcelRow(int curRow,
int rows)
public List<Map<String,String>> getDataByRow(int startRow, Map<String,Integer> header)
startRow - 开始行header - 对应列序号public String getCellValue(org.apache.poi.ss.usermodel.Cell cell)
cell - 单元格public String getCellValue(int rowNo, int colNo)
rowNo - 行号colNo - 列号public void setCellValue(int rowNo,
int colNo,
String value)
rowNo - 行colNo - 列value - 值public float[] getColWidth(int maxColNum)
public int getMaxRowNum()
public int getMaxColNum(int rowNum)
public org.apache.poi.ss.usermodel.Workbook getWorkbook()
public org.apache.poi.ss.usermodel.Sheet getSheet()
public org.apache.poi.ss.usermodel.Row getRow(int i)
public String getFile()
Copyright © 2024. All rights reserved.