public class InternalExcelUtil extends Object
| 构造器和说明 |
|---|
InternalExcelUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static org.apache.poi.ss.usermodel.CellStyle |
cloneCellStyle(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellStyle cellStyle)
克隆新的
CellStyle |
static org.apache.poi.ss.usermodel.CellStyle |
cloneCellStyle(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.CellStyle cellStyle)
克隆新的
CellStyle |
static org.apache.poi.ss.usermodel.CellStyle |
createDefaultCellStyle(org.apache.poi.ss.usermodel.Workbook workbook)
创建默认普通单元格样式
1.
|
static org.apache.poi.ss.usermodel.CellStyle |
createHeadCellStyle(org.apache.poi.ss.usermodel.Workbook workbook)
创建默认头部样式
|
static Object |
getCellValue(org.apache.poi.ss.usermodel.Cell cell,
boolean isTrimCellValue)
获取单元格值
|
static Object |
getCellValue(org.apache.poi.ss.usermodel.Cell cell,
CellEditor cellEditor)
获取单元格值
|
static Object |
getCellValue(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellType cellType,
boolean isTrimCellValue)
获取单元格值
|
static Object |
getCellValue(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellType cellType,
CellEditor cellEditor)
获取单元格值
如果单元格值为数字格式,则判断其格式中是否有小数部分,无则返回Long类型,否则返回Double类型 |
static Map<String,org.apache.poi.ss.usermodel.PictureData> |
getPicMap(org.apache.poi.ss.usermodel.Workbook workbook,
int sheetIndex)
获取工作簿指定sheet中图片列表
|
static boolean |
isMergedRegion(org.apache.poi.ss.usermodel.Sheet sheet,
int row,
int column)
判断指定的单元格是否是合并单元格
|
static int |
mergingCells(org.apache.poi.ss.usermodel.Sheet sheet,
int firstRow,
int lastRow,
int firstColumn,
int lastColumn,
org.apache.poi.ss.usermodel.CellStyle cellStyle)
合并单元格,可以根据设置的值来合并行和列
|
static List<Object> |
readRow(org.apache.poi.ss.usermodel.Row row,
CellEditor cellEditor)
读取一行
|
static org.apache.poi.ss.usermodel.CellStyle |
setAlign(org.apache.poi.ss.usermodel.CellStyle cellStyle,
org.apache.poi.ss.usermodel.HorizontalAlignment halign,
org.apache.poi.ss.usermodel.VerticalAlignment valign)
cell文本位置样式
|
static org.apache.poi.ss.usermodel.CellStyle |
setBorder(org.apache.poi.ss.usermodel.CellStyle cellStyle,
org.apache.poi.ss.usermodel.BorderStyle borderSize,
org.apache.poi.ss.usermodel.IndexedColors colorIndex)
设置cell的四个边框粗细和颜色
|
static void |
setCellValue(org.apache.poi.ss.usermodel.Cell cell,
Object value,
StyleSet styleSet)
设置单元格值
|
static org.apache.poi.ss.usermodel.CellStyle |
setColor(org.apache.poi.ss.usermodel.CellStyle cellStyle,
org.apache.poi.ss.usermodel.IndexedColors backgroundColor,
org.apache.poi.ss.usermodel.FillPatternType fillPattern)
给cell设置颜色
|
static void |
writeRow(org.apache.poi.ss.usermodel.Row row,
Iterable<?> rowData,
StyleSet styleSet)
写一行数据
|
public static Object getCellValue(org.apache.poi.ss.usermodel.Cell cell, boolean isTrimCellValue)
cell - Cell单元格isTrimCellValue - 如果单元格类型为字符串,是否去掉两边空白符public static Object getCellValue(org.apache.poi.ss.usermodel.Cell cell, CellEditor cellEditor)
cell - Cell单元格cellEditor - 单元格值编辑器。可以通过此编辑器对单元格值做自定义操作public static Object getCellValue(org.apache.poi.ss.usermodel.Cell cell, org.apache.poi.ss.usermodel.CellType cellType, boolean isTrimCellValue)
cell - Cell单元格cellType - 单元格值类型CellType枚举isTrimCellValue - 如果单元格类型为字符串,是否去掉两边空白符public static Object getCellValue(org.apache.poi.ss.usermodel.Cell cell, org.apache.poi.ss.usermodel.CellType cellType, CellEditor cellEditor)
cell - Cell单元格cellType - 单元格值类型CellType枚举,如果为null默认使用cell的类型cellEditor - 单元格值编辑器。可以通过此编辑器对单元格值做自定义操作public static void setCellValue(org.apache.poi.ss.usermodel.Cell cell,
Object value,
StyleSet styleSet)
cell - 单元格value - 值styleSet - 单元格样式集,包括日期等样式public static org.apache.poi.ss.usermodel.CellStyle cloneCellStyle(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellStyle cellStyle)
CellStylecell - 单元格cellStyle - 被复制的样式CellStylepublic static org.apache.poi.ss.usermodel.CellStyle cloneCellStyle(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.CellStyle cellStyle)
CellStyleworkbook - 工作簿cellStyle - 被复制的样式CellStylepublic static List<Object> readRow(org.apache.poi.ss.usermodel.Row row, CellEditor cellEditor)
row - 行cellEditor - 单元格编辑器public static void writeRow(org.apache.poi.ss.usermodel.Row row,
Iterable<?> rowData,
StyleSet styleSet)
row - 行rowData - 一行的数据styleSet - 单元格样式集,包括日期等样式public static Map<String,org.apache.poi.ss.usermodel.PictureData> getPicMap(org.apache.poi.ss.usermodel.Workbook workbook, int sheetIndex)
workbook - 工作簿WorkbooksheetIndex - sheet的索引PictureDatapublic static boolean isMergedRegion(org.apache.poi.ss.usermodel.Sheet sheet,
int row,
int column)
sheet - Sheetrow - 行号column - 列号public static int mergingCells(org.apache.poi.ss.usermodel.Sheet sheet,
int firstRow,
int lastRow,
int firstColumn,
int lastColumn,
org.apache.poi.ss.usermodel.CellStyle cellStyle)
sheet - 表对象firstRow - 起始行,0开始lastRow - 结束行,0开始firstColumn - 起始列,0开始lastColumn - 结束列,0开始cellStyle - 单元格样式public static org.apache.poi.ss.usermodel.CellStyle setAlign(org.apache.poi.ss.usermodel.CellStyle cellStyle,
org.apache.poi.ss.usermodel.HorizontalAlignment halign,
org.apache.poi.ss.usermodel.VerticalAlignment valign)
cellStyle - CellStylehalign - 横向位置valign - 纵向位置CellStylepublic static org.apache.poi.ss.usermodel.CellStyle setBorder(org.apache.poi.ss.usermodel.CellStyle cellStyle,
org.apache.poi.ss.usermodel.BorderStyle borderSize,
org.apache.poi.ss.usermodel.IndexedColors colorIndex)
cellStyle - CellStyleborderSize - 边框粗细BorderStyle枚举colorIndex - 颜色的short值CellStylepublic static org.apache.poi.ss.usermodel.CellStyle setColor(org.apache.poi.ss.usermodel.CellStyle cellStyle,
org.apache.poi.ss.usermodel.IndexedColors backgroundColor,
org.apache.poi.ss.usermodel.FillPatternType fillPattern)
cellStyle - CellStylebackgroundColor - 背景颜色fillPattern - 填充方式 FillPatternType枚举CellStylepublic static org.apache.poi.ss.usermodel.CellStyle createDefaultCellStyle(org.apache.poi.ss.usermodel.Workbook workbook)
1. 文字上下左右居中 2. 细边框,黑色
workbook - Workbook 工作簿CellStylepublic static org.apache.poi.ss.usermodel.CellStyle createHeadCellStyle(org.apache.poi.ss.usermodel.Workbook workbook)
workbook - Workbook 工作簿CellStyleCopyright © 2018. All rights reserved.