public class CellOperateUtil
extends java.lang.Object
| 构造器和说明 |
|---|
CellOperateUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static org.apache.poi.ss.usermodel.Cell |
getCell(org.apache.poi.ss.usermodel.Row row,
int columnNum)
Get a specific cell from a row.
|
static java.lang.Object |
getCellValue(org.apache.poi.ss.usermodel.Cell cell) |
static java.lang.Object |
getCellValue(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellType cellType) |
static int |
getLastCellNum(org.apache.poi.ss.usermodel.Row row)
get the last column num of row, base 1;
获取最后列号,从1开始
|
static java.lang.String |
getStringCellValue(org.apache.poi.ss.usermodel.Cell cell)
获取单元格的字符串值
|
static void |
mergeCells(org.apache.poi.ss.usermodel.Sheet sheet,
int firstRowNum,
int firstColumnNum,
int lastRowNum,
int lastColumnNum)
merge cells safely
|
static void |
mergeCellsByUnsafe(org.apache.poi.ss.usermodel.Sheet sheet,
int firstRowNum,
int firstColumnNum,
int lastRowNum,
int lastColumnNum)
merge cells unsafely, so need to invoke
sheet.validateMergedRegions() ; |
static void |
setCellValue(org.apache.poi.ss.usermodel.Cell cell,
java.lang.Object value) |
static java.lang.String |
toColumnLabel(int columnNum)
单元格中列序号转换成列字母编号,默认列序号从1开始
1="A"
26="Z"
27="AA
|
static int |
toColumnNum(java.lang.String columnNo)
单元格中列的字母序号转换成从1开始列号
"A"=1
"Z"=26
"AA"=27
|
public static org.apache.poi.ss.usermodel.Cell getCell(org.apache.poi.ss.usermodel.Row row,
int columnNum)
row - The row that the cell is part ofcolumnNum - The column num that the cell is in. base 1;public static java.lang.Object getCellValue(org.apache.poi.ss.usermodel.Cell cell)
public static java.lang.Object getCellValue(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellType cellType)
public static int getLastCellNum(org.apache.poi.ss.usermodel.Row row)
row - rowpublic static java.lang.String getStringCellValue(org.apache.poi.ss.usermodel.Cell cell)
cell - 单元格public static java.lang.String toColumnLabel(int columnNum)
1="A"
26="Z"
27="AA
columnNum - 列号,从1开始public static int toColumnNum(java.lang.String columnNo)
"A"=1
"Z"=26
"AA"=27
columnNo - 字母序号public static void setCellValue(org.apache.poi.ss.usermodel.Cell cell,
java.lang.Object value)
public static void mergeCellsByUnsafe(org.apache.poi.ss.usermodel.Sheet sheet,
int firstRowNum,
int firstColumnNum,
int lastRowNum,
int lastColumnNum)
sheet.validateMergedRegions() ;sheet - sheetfirstRowNum - the row num of first cellfirstColumnNum - the column's num of first celllastRowNum - the row num of last celllastColumnNum - he column's num of last cellpublic static void mergeCells(org.apache.poi.ss.usermodel.Sheet sheet,
int firstRowNum,
int firstColumnNum,
int lastRowNum,
int lastColumnNum)
sheet - sheetfirstRowNum - the row num of first cellfirstColumnNum - the column's num of first celllastRowNum - the row num of last celllastColumnNum - he column's num of last cell