public class Excels extends Object
Modifier and Type | Method and Description |
---|---|
static void |
addSelectOptions(org.apache.poi.ss.usermodel.Sheet sheet,
int startRow,
int endRow,
int startColumn,
int endColumn,
String[] options)
添加下拉框
|
static void |
addSelectOptions(org.apache.poi.ss.usermodel.Sheet sheet,
int startRow,
int endRow,
int column,
String[] options)
添加下拉框
|
static void |
addSelectOptions(org.apache.poi.ss.usermodel.Sheet sheet,
int startRow,
int column,
String[] options)
添加下拉框
|
static void |
addSelectOptions(org.apache.poi.ss.usermodel.Sheet sheet,
int column,
String[] options)
添加下拉框
|
static void |
close(org.apache.poi.ss.usermodel.Workbook workbook)
关闭workbook
|
static void |
copyCellValue(org.apache.poi.ss.usermodel.Cell source,
org.apache.poi.ss.usermodel.Cell target)
复制cell的值
|
static SheetCopier |
copySheet(org.apache.poi.ss.usermodel.Workbook resourceWorkbook,
org.apache.poi.ss.usermodel.Workbook targetWorkbook,
int resourceIndex)
复制sheet 新建sheet
|
static SheetCopier |
copySheet(org.apache.poi.ss.usermodel.Workbook resourceWorkbook,
org.apache.poi.ss.usermodel.Workbook targetWorkbook,
int resourceIndex,
int targetIndex)
复制sheet 如果未找到目标sheet 则新建sheet
|
static org.apache.poi.ss.usermodel.Comment |
createComment(org.apache.poi.ss.usermodel.Sheet sheet,
int column,
int row,
CommentOption option)
创建批注
|
static org.apache.poi.ss.usermodel.Comment |
createComment(org.apache.poi.ss.usermodel.Sheet sheet,
int column,
int row,
String comment)
创建批注
|
static PictureParser |
createPictureParser(org.apache.poi.ss.usermodel.Sheet sheet)
创建图片解析器
|
static PictureParser |
createPictureParser(org.apache.poi.ss.usermodel.Workbook workbook,
int index)
创建图片解析器
|
static PictureParser |
createPictureParser(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.Sheet sheet)
创建图片解析器
|
static void |
filterFirstRow(org.apache.poi.ss.usermodel.Sheet sheet)
筛选首行
|
static void |
filterFirstRow(org.apache.poi.ss.usermodel.Sheet sheet,
int lastColumn)
筛选首行
|
static void |
filterFirstRow(org.apache.poi.ss.usermodel.Sheet sheet,
int firstColumn,
int lastColumn)
筛选首行
|
static void |
filterRow(org.apache.poi.ss.usermodel.Sheet sheet,
int rowIndex)
筛选行
|
static void |
filterRow(org.apache.poi.ss.usermodel.Sheet sheet,
int rowIndex,
int lastColumn)
筛选行
|
static void |
filterRow(org.apache.poi.ss.usermodel.Sheet sheet,
int rowIndex,
int firstColumn,
int lastColumn)
筛选行
|
static void |
freezeFirstRow(org.apache.poi.ss.usermodel.Sheet sheet)
冻结首行
|
static void |
freezeRow(org.apache.poi.ss.usermodel.Sheet sheet,
int lastRow)
冻结行
|
static org.apache.poi.ss.usermodel.Cell |
getCell(org.apache.poi.ss.usermodel.Sheet sheet,
int row,
int column)
获取单元格 (可能为null)
|
static String |
getCellComment(org.apache.poi.ss.usermodel.Cell cell)
获取批注
|
static Date |
getCellDate(org.apache.poi.ss.usermodel.Cell cell)
获取时间
|
static Date |
getCellDate(org.apache.poi.ss.usermodel.Cell cell,
CellOption option)
获取时间
|
static Date |
getCellDate(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellType type,
CellOption option)
获取时间
|
static BigDecimal |
getCellDecimal(org.apache.poi.ss.usermodel.Cell cell)
获取数字
|
static BigDecimal |
getCellDecimal(org.apache.poi.ss.usermodel.Cell cell,
CellOption option)
获取数字
|
static BigDecimal |
getCellDecimal(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellType type,
CellOption option)
获取数字
|
static String |
getCellHyperUrl(org.apache.poi.ss.usermodel.Cell cell)
获取超链接
|
static Integer |
getCellInteger(org.apache.poi.ss.usermodel.Cell cell)
获取数字
|
static Integer |
getCellInteger(org.apache.poi.ss.usermodel.Cell cell,
CellOption option)
获取数字
|
static Integer |
getCellInteger(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellType type,
CellOption option)
获取数字
|
static Long |
getCellLong(org.apache.poi.ss.usermodel.Cell cell)
获取数字
|
static Long |
getCellLong(org.apache.poi.ss.usermodel.Cell cell,
CellOption option)
获取数字
|
static Long |
getCellLong(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellType type,
CellOption option)
获取数字
|
static org.apache.poi.ss.usermodel.Cell |
getCellMerge(org.apache.poi.ss.usermodel.Sheet sheet,
int row,
int column)
获取单元格 如果是合并则获取合并后的
|
static String |
getCellPhone(org.apache.poi.ss.usermodel.Cell cell)
获取手机号
|
static String |
getCellPhone(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellType type)
获取手机号
|
static org.apache.poi.ss.usermodel.CellStyle |
getCellStyle(org.apache.poi.ss.usermodel.Sheet sheet,
int row,
int column)
获取单元格样式 (可能为null)
|
static String |
getCellValue(org.apache.poi.ss.usermodel.Cell cell)
获取String的值
|
static String |
getCellValue(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellType type)
获取String的值
|
static <T> T |
getCellValue(org.apache.poi.ss.usermodel.Cell cell,
ExcelReadType type)
通过类型获取值
|
static <T> T |
getCellValue(org.apache.poi.ss.usermodel.Cell cell,
ExcelReadType type,
CellOption option)
通过类型获取值
|
static org.apache.poi.xssf.usermodel.XSSFColor |
getColor(String rgb)
获取颜色
|
static int |
getColumnCount(org.apache.poi.ss.usermodel.Sheet sheet)
获取列数
|
static int |
getColumnCount(org.apache.poi.ss.usermodel.Sheet sheet,
int rowNum)
获取列数
|
static int |
getColumnNumber(String s)
获取列对应的数值
A -> 1
Z -> 26
AA -> 27
|
static String |
getColumnSymbol(int column)
获取数值对应的列
1 -> A
26 -> Z
27 -> AA
|
static ExcelFieldType |
getFieldType(Class<?> clazz)
获取字段类型
|
static ExcelFieldType |
getFieldType(Object o)
获取字段类型
|
static FooterOption |
getFooter(org.apache.poi.ss.usermodel.Sheet sheet)
获取页脚
|
static HeaderOption |
getHeader(org.apache.poi.ss.usermodel.Sheet sheet)
获取页眉
|
static int |
getPhysicalRowCount(org.apache.poi.ss.usermodel.Sheet sheet)
获取实际总行数 (不全)
|
static PropertiesOption |
getProperties(org.apache.poi.ss.usermodel.Workbook workbook)
获取属性
|
static org.apache.poi.ss.usermodel.Row |
getRow(org.apache.poi.ss.usermodel.Sheet sheet,
int index)
获取行 (可能为null)
|
static int |
getRowCount(org.apache.poi.ss.usermodel.Sheet sheet)
获取最后一行的位置 (索引+1 但有可能行为空)
|
static org.apache.poi.ss.usermodel.CellStyle |
getRowStyle(org.apache.poi.ss.usermodel.Sheet sheet,
int index)
获取行样式 (可能为null)
|
static byte[] |
getThumbnail(org.apache.poi.ss.usermodel.Workbook workbook)
获取缩略图
|
static int |
getWidth(double width)
获取 poi 的 width
|
static int |
getWidth(int width)
获取 poi 的 width
|
static boolean |
isStreamingSheet(Class<?> clazz)
是否为流式读取的sheet
|
static boolean |
isStreamingSheet(org.apache.poi.ss.usermodel.Sheet sheet)
是否为流式读取的sheet
|
static boolean |
isStreamingWorkbook(Class<?> clazz)
是否为流式读取的workbook
|
static boolean |
isStreamingWorkbook(org.apache.poi.ss.usermodel.Workbook workbook)
是否为流式读取的workbook
|
static void |
mergeCell(org.apache.poi.ss.usermodel.Sheet sheet,
org.apache.poi.ss.util.CellRangeAddress region)
合并单元格
|
static void |
mergeCell(org.apache.poi.ss.usermodel.Sheet sheet,
int row,
int firstColumn,
int lastColumn)
合并单元格
|
static void |
mergeCell(org.apache.poi.ss.usermodel.Sheet sheet,
int firstRow,
int lastRow,
int firstColumn,
int lastColumn)
合并单元格
|
static void |
mergeCellBorder(org.apache.poi.ss.usermodel.Sheet sheet,
int borderCode,
int colorIndex,
org.apache.poi.ss.util.CellRangeAddress region)
合并单元格边框
|
static void |
mergeCellBorder(org.apache.poi.ss.usermodel.Sheet sheet,
int borderCode,
int colorIndex,
int row,
int firstColumn,
int lastColumn)
合并单元格边框
|
static void |
mergeCellBorder(org.apache.poi.ss.usermodel.Sheet sheet,
int borderCode,
int colorIndex,
int firstRow,
int lastRow,
int firstColumn,
int lastColumn)
合并单元格边框
|
static org.apache.poi.ss.util.CellRangeAddress |
mergeCellRange(int row,
int firstColumn,
int lastColumn)
合并单元格
|
static org.apache.poi.ss.util.CellRangeAddress |
mergeCellRange(int firstRow,
int lastRow,
int firstColumn,
int lastColumn)
合并单元格
|
static org.apache.poi.ss.usermodel.Workbook |
openStreamingWorkbook(File file) |
static org.apache.poi.ss.usermodel.Workbook |
openStreamingWorkbook(File file,
int rowCache) |
static org.apache.poi.ss.usermodel.Workbook |
openStreamingWorkbook(File file,
int rowCache,
int bufferSize) |
static org.apache.poi.ss.usermodel.Workbook |
openStreamingWorkbook(File file,
String password) |
static org.apache.poi.ss.usermodel.Workbook |
openStreamingWorkbook(File file,
String password,
int rowCache) |
static org.apache.poi.ss.usermodel.Workbook |
openStreamingWorkbook(File file,
String password,
int rowCache,
int bufferSize) |
static org.apache.poi.ss.usermodel.Workbook |
openStreamingWorkbook(InputStream in) |
static org.apache.poi.ss.usermodel.Workbook |
openStreamingWorkbook(InputStream in,
int rowCache) |
static org.apache.poi.ss.usermodel.Workbook |
openStreamingWorkbook(InputStream in,
int rowCache,
int bufferSize) |
static org.apache.poi.ss.usermodel.Workbook |
openStreamingWorkbook(InputStream in,
String password) |
static org.apache.poi.ss.usermodel.Workbook |
openStreamingWorkbook(InputStream in,
String password,
int rowCache) |
static org.apache.poi.ss.usermodel.Workbook |
openStreamingWorkbook(InputStream in,
String password,
int rowCache,
int bufferSize)
获取流式workbook
|
static org.apache.poi.ss.usermodel.Workbook |
openStreamingWorkbook(String file) |
static org.apache.poi.ss.usermodel.Workbook |
openStreamingWorkbook(String file,
int rowCache) |
static org.apache.poi.ss.usermodel.Workbook |
openStreamingWorkbook(String file,
int rowCache,
int bufferSize) |
static org.apache.poi.ss.usermodel.Workbook |
openStreamingWorkbook(String file,
String password) |
static org.apache.poi.ss.usermodel.Workbook |
openStreamingWorkbook(String file,
String password,
int rowCache) |
static org.apache.poi.ss.usermodel.Workbook |
openStreamingWorkbook(String file,
String password,
int rowCache,
int bufferSize) |
static org.apache.poi.ss.usermodel.Workbook |
openWorkbook(File file) |
static org.apache.poi.ss.usermodel.Workbook |
openWorkbook(File file,
String password) |
static org.apache.poi.ss.usermodel.Workbook |
openWorkbook(InputStream in) |
static org.apache.poi.ss.usermodel.Workbook |
openWorkbook(InputStream in,
String password)
获取workbook
|
static org.apache.poi.ss.usermodel.Workbook |
openWorkbook(String file) |
static org.apache.poi.ss.usermodel.Workbook |
openWorkbook(String file,
String password) |
static short |
paletteColor(org.apache.poi.ss.usermodel.Workbook workbook,
short index,
byte[] rgb)
调色板 主要用与 HSSFColor
|
static short |
paletteColor(org.apache.poi.ss.usermodel.Workbook workbook,
short index,
String rgb)
调色板 主要用与 HSSFColor
|
static org.apache.poi.ss.usermodel.CellStyle |
parseColumnStyle(org.apache.poi.ss.usermodel.Workbook workbook,
ExportFieldOption option)
解析列样式
|
static org.apache.poi.ss.usermodel.Font |
parseFont(org.apache.poi.ss.usermodel.Workbook workbook,
FontOption option)
解析字体
|
static org.apache.poi.ss.usermodel.PrintSetup |
parsePrint(org.apache.poi.ss.usermodel.Sheet sheet,
PrintOption option)
解析打印
|
static org.apache.poi.ss.usermodel.CellStyle |
parseStyle(org.apache.poi.ss.usermodel.Workbook workbook,
ExportFieldOption option)
解析样式
|
static org.apache.poi.ss.usermodel.CellStyle |
parseTitleStyle(org.apache.poi.ss.usermodel.Workbook workbook,
TitleOption option)
解析标题样式
|
static void |
setCellValue(org.apache.poi.ss.usermodel.Cell cell,
Object value)
设置cell的值
|
static void |
setCellValue(org.apache.poi.ss.usermodel.Cell cell,
Object value,
ExcelFieldType type)
设置cell的值
|
static void |
setCellValue(org.apache.poi.ss.usermodel.Cell cell,
Object value,
ExcelFieldType type,
CellOption option)
设置cell的值
|
static void |
setDefaultProperties(org.apache.poi.ss.usermodel.Workbook workbook)
设置默认配置属性
|
static void |
setFooter(org.apache.poi.ss.usermodel.Sheet sheet,
FooterOption option)
获取页脚
|
static void |
setHeader(org.apache.poi.ss.usermodel.Sheet sheet,
HeaderOption option)
设置页眉
|
static void |
setLink(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.Cell cell,
ExcelLinkType linkType,
String address,
ExcelFieldType textType,
CellOption option,
Object text)
设置超链接
|
static void |
setLink(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.Cell cell,
ExcelLinkType linkType,
String address,
ExcelFieldType textType,
Object text)
设置超链接
|
static org.apache.poi.ss.usermodel.Picture |
setPicture(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.Sheet sheet,
byte[] image,
int rowIndex,
int columnIndex)
添加图片
|
static org.apache.poi.ss.usermodel.Picture |
setPicture(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.Sheet sheet,
byte[] image,
int rowIndex,
int columnIndex,
ExcelPictureType type)
添加图片
|
static org.apache.poi.ss.usermodel.Picture |
setPicture(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.Sheet sheet,
byte[] image,
int rowIndex,
int columnIndex,
String fileName)
添加图片
|
static org.apache.poi.ss.usermodel.Picture |
setPicture(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.Sheet sheet,
byte[] image,
int rowIndex,
int columnIndex,
String fileName,
ExcelPictureType type)
添加图片
|
static org.apache.poi.ss.usermodel.Picture |
setPicture(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.Sheet sheet,
File image,
int rowIndex,
int columnIndex)
添加图片
|
static org.apache.poi.ss.usermodel.Picture |
setPicture(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.Sheet sheet,
File image,
int rowIndex,
int columnIndex,
ExcelPictureType type)
添加图片
|
static org.apache.poi.ss.usermodel.Picture |
setPicture(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.Sheet sheet,
File image,
int rowIndex,
int columnIndex,
String fileName)
添加图片
|
static org.apache.poi.ss.usermodel.Picture |
setPicture(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.Sheet sheet,
InputStream image,
int rowIndex,
int columnIndex)
添加图片
|
static org.apache.poi.ss.usermodel.Picture |
setPicture(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.Sheet sheet,
InputStream image,
int rowIndex,
int columnIndex,
ExcelPictureType type)
添加图片
|
static org.apache.poi.ss.usermodel.Picture |
setPicture(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.Sheet sheet,
InputStream image,
int rowIndex,
int columnIndex,
String fileName)
添加图片
|
static org.apache.poi.ss.usermodel.Picture |
setPicture(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.Sheet sheet,
String image,
int rowIndex,
int columnIndex)
添加图片
|
static org.apache.poi.ss.usermodel.Picture |
setPicture(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.Sheet sheet,
String image,
int rowIndex,
int columnIndex,
ExcelPictureType type)
添加图片
|
static org.apache.poi.ss.usermodel.Picture |
setPicture(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.Sheet sheet,
String image,
int rowIndex,
int columnIndex,
String fileName)
添加图片
|
static void |
setProperties(org.apache.poi.ss.usermodel.Workbook workbook,
PropertiesOption option)
设置属性
|
static void |
setThumbnail(org.apache.poi.ss.usermodel.Workbook workbook,
byte[] thumbnail)
设置缩略图
|
static void |
setThumbnail(org.apache.poi.ss.usermodel.Workbook workbook,
byte[] thumbnail,
String fileName)
Deprecated.
XLS 设置写入会报错
|
static void |
setThumbnail(org.apache.poi.ss.usermodel.Workbook workbook,
File thumbnail)
设置缩略图
|
static void |
setThumbnail(org.apache.poi.ss.usermodel.Workbook workbook,
InputStream thumbnail)
设置缩略图
|
static void |
setThumbnail(org.apache.poi.ss.usermodel.Workbook workbook,
InputStream thumbnail,
String fileName)
设置缩略图
|
static void |
setThumbnail(org.apache.poi.ss.usermodel.Workbook workbook,
String thumbnail)
设置缩略图
|
static void |
write(org.apache.poi.ss.usermodel.Workbook workbook,
File file) |
static void |
write(org.apache.poi.ss.usermodel.Workbook workbook,
File file,
String password) |
static void |
write(org.apache.poi.ss.usermodel.Workbook workbook,
OutputStream out) |
static void |
write(org.apache.poi.ss.usermodel.Workbook workbook,
OutputStream out,
boolean close)
写入workbook到流
|
static void |
write(org.apache.poi.ss.usermodel.Workbook workbook,
OutputStream out,
String password) |
static void |
write(org.apache.poi.ss.usermodel.Workbook workbook,
OutputStream out,
String password,
boolean close)
写入workbook到流
|
static void |
write(org.apache.poi.ss.usermodel.Workbook workbook,
String file) |
static void |
write(org.apache.poi.ss.usermodel.Workbook workbook,
String file,
String password) |
public static int getColumnNumber(String s)
s
- 列public static String getColumnSymbol(int column)
column
- 列public static int getWidth(int width)
width
- widthpublic static int getWidth(double width)
width
- widthpublic static <T> T getCellValue(org.apache.poi.ss.usermodel.Cell cell, ExcelReadType type)
T
- Tcell
- celltype
- type 不包含picturepublic static <T> T getCellValue(org.apache.poi.ss.usermodel.Cell cell, ExcelReadType type, CellOption option)
public static String getCellValue(org.apache.poi.ss.usermodel.Cell cell)
cell
- cellpublic static String getCellValue(org.apache.poi.ss.usermodel.Cell cell, org.apache.poi.ss.usermodel.CellType type)
cell
- celltype
- typepublic static BigDecimal getCellDecimal(org.apache.poi.ss.usermodel.Cell cell)
cell
- cellpublic static BigDecimal getCellDecimal(org.apache.poi.ss.usermodel.Cell cell, CellOption option)
cell
- celloption
- optionpublic static BigDecimal getCellDecimal(org.apache.poi.ss.usermodel.Cell cell, org.apache.poi.ss.usermodel.CellType type, CellOption option)
cell
- celltype
- typeoption
- optionpublic static Integer getCellInteger(org.apache.poi.ss.usermodel.Cell cell)
cell
- cellpublic static Integer getCellInteger(org.apache.poi.ss.usermodel.Cell cell, CellOption option)
cell
- celloption
- optionpublic static Integer getCellInteger(org.apache.poi.ss.usermodel.Cell cell, org.apache.poi.ss.usermodel.CellType type, CellOption option)
cell
- celltype
- typeoption
- optionpublic static Long getCellLong(org.apache.poi.ss.usermodel.Cell cell)
cell
- cellpublic static Long getCellLong(org.apache.poi.ss.usermodel.Cell cell, CellOption option)
cell
- celloption
- optionpublic static Long getCellLong(org.apache.poi.ss.usermodel.Cell cell, org.apache.poi.ss.usermodel.CellType type, CellOption option)
cell
- celltype
- typeoption
- optionpublic static Date getCellDate(org.apache.poi.ss.usermodel.Cell cell)
cell
- cellpublic static Date getCellDate(org.apache.poi.ss.usermodel.Cell cell, CellOption option)
cell
- celloption
- optionpublic static Date getCellDate(org.apache.poi.ss.usermodel.Cell cell, org.apache.poi.ss.usermodel.CellType type, CellOption option)
cell
- celltype
- typeoption
- optionpublic static String getCellPhone(org.apache.poi.ss.usermodel.Cell cell)
cell
- cellpublic static String getCellPhone(org.apache.poi.ss.usermodel.Cell cell, org.apache.poi.ss.usermodel.CellType type)
cell
- cellpublic static String getCellComment(org.apache.poi.ss.usermodel.Cell cell)
cell
- cellpublic static String getCellHyperUrl(org.apache.poi.ss.usermodel.Cell cell)
cell
- cellpublic static org.apache.poi.ss.usermodel.Row getRow(org.apache.poi.ss.usermodel.Sheet sheet, int index)
sheet
- sheetindex
- indexpublic static org.apache.poi.ss.usermodel.CellStyle getRowStyle(org.apache.poi.ss.usermodel.Sheet sheet, int index)
sheet
- sheetindex
- indexpublic static org.apache.poi.ss.usermodel.Cell getCell(org.apache.poi.ss.usermodel.Sheet sheet, int row, int column)
sheet
- sheetrow
- rowIndexcolumn
- columnIndexpublic static org.apache.poi.ss.usermodel.CellStyle getCellStyle(org.apache.poi.ss.usermodel.Sheet sheet, int row, int column)
sheet
- sheetrow
- rowIndexcolumn
- columnIndexpublic static org.apache.poi.ss.usermodel.Cell getCellMerge(org.apache.poi.ss.usermodel.Sheet sheet, int row, int column)
sheet
- sheetrow
- rowIndexcolumn
- columnIndexpublic static ExcelFieldType getFieldType(Object o)
o
- objectExcelFieldType
public static ExcelFieldType getFieldType(Class<?> clazz)
clazz
- clazzExcelFieldType
public static void setCellValue(org.apache.poi.ss.usermodel.Cell cell, Object value)
cell
- cellvalue
- valuepublic static void setCellValue(org.apache.poi.ss.usermodel.Cell cell, Object value, ExcelFieldType type)
cell
- cellvalue
- valuetype
- typepublic static void setCellValue(org.apache.poi.ss.usermodel.Cell cell, Object value, ExcelFieldType type, CellOption option)
cell
- cellvalue
- valuetype
- typeoption
- 参数public static void copyCellValue(org.apache.poi.ss.usermodel.Cell source, org.apache.poi.ss.usermodel.Cell target)
source
- 原始target
- 目标public static int getRowCount(org.apache.poi.ss.usermodel.Sheet sheet)
sheet
- sheetpublic static int getPhysicalRowCount(org.apache.poi.ss.usermodel.Sheet sheet)
sheet
- sheetpublic static int getColumnCount(org.apache.poi.ss.usermodel.Sheet sheet)
sheet
- sheetpublic static int getColumnCount(org.apache.poi.ss.usermodel.Sheet sheet, int rowNum)
sheet
- sheetrowNum
- 行索引public static org.apache.poi.xssf.usermodel.XSSFColor getColor(String rgb)
rgb
- rgbpublic static short paletteColor(org.apache.poi.ss.usermodel.Workbook workbook, short index, String rgb)
index
- indexrgb
- colorpublic static short paletteColor(org.apache.poi.ss.usermodel.Workbook workbook, short index, byte[] rgb)
index
- indexrgb
- colorpublic static PictureParser createPictureParser(org.apache.poi.ss.usermodel.Sheet sheet)
sheet
- sheetpublic static PictureParser createPictureParser(org.apache.poi.ss.usermodel.Workbook workbook, int index)
workbook
- workbookindex
- sheetIndexpublic static PictureParser createPictureParser(org.apache.poi.ss.usermodel.Workbook workbook, org.apache.poi.ss.usermodel.Sheet sheet)
workbook
- workbooksheet
- sheetpublic static byte[] getThumbnail(org.apache.poi.ss.usermodel.Workbook workbook)
workbook
- workbookpublic static void setThumbnail(org.apache.poi.ss.usermodel.Workbook workbook, File thumbnail)
workbook
- workbookthumbnail
- 缩略图public static void setThumbnail(org.apache.poi.ss.usermodel.Workbook workbook, String thumbnail)
workbook
- workbookthumbnail
- 缩略图public static void setThumbnail(org.apache.poi.ss.usermodel.Workbook workbook, InputStream thumbnail)
workbook
- workbookthumbnail
- 缩略图public static void setThumbnail(org.apache.poi.ss.usermodel.Workbook workbook, byte[] thumbnail)
workbook
- workbookthumbnail
- 缩略图public static void setThumbnail(org.apache.poi.ss.usermodel.Workbook workbook, InputStream thumbnail, String fileName)
workbook
- workbookthumbnail
- 缩略图fileName
- 文件名public static void setThumbnail(org.apache.poi.ss.usermodel.Workbook workbook, byte[] thumbnail, String fileName)
workbook
- workbookthumbnail
- 缩略图fileName
- 文件名519
public static PropertiesOption getProperties(org.apache.poi.ss.usermodel.Workbook workbook)
workbook
- workbookpublic static void setProperties(org.apache.poi.ss.usermodel.Workbook workbook, PropertiesOption option)
workbook
- workbookoption
- 属性public static void setDefaultProperties(org.apache.poi.ss.usermodel.Workbook workbook)
workbook
- workbookpublic static HeaderOption getHeader(org.apache.poi.ss.usermodel.Sheet sheet)
sheet
- sheetpublic static void setHeader(org.apache.poi.ss.usermodel.Sheet sheet, HeaderOption option)
sheet
- sheetoption
- 页眉public static FooterOption getFooter(org.apache.poi.ss.usermodel.Sheet sheet)
sheet
- sheetpublic static void setFooter(org.apache.poi.ss.usermodel.Sheet sheet, FooterOption option)
sheet
- sheetoption
- 页脚public static org.apache.poi.ss.usermodel.Comment createComment(org.apache.poi.ss.usermodel.Sheet sheet, int column, int row, String comment)
sheet
- sheetcolumn
- 列索引row
- 行索引comment
- 批注public static org.apache.poi.ss.usermodel.Comment createComment(org.apache.poi.ss.usermodel.Sheet sheet, int column, int row, CommentOption option)
sheet
- sheetcolumn
- 列索引row
- 行索引option
- 批注public static org.apache.poi.ss.usermodel.CellStyle parseStyle(org.apache.poi.ss.usermodel.Workbook workbook, ExportFieldOption option)
workbook
- workbookoption
- optionpublic static org.apache.poi.ss.usermodel.CellStyle parseColumnStyle(org.apache.poi.ss.usermodel.Workbook workbook, ExportFieldOption option)
workbook
- workbookoption
- optionpublic static org.apache.poi.ss.usermodel.CellStyle parseTitleStyle(org.apache.poi.ss.usermodel.Workbook workbook, TitleOption option)
workbook
- workbookoption
- optionpublic static org.apache.poi.ss.usermodel.Font parseFont(org.apache.poi.ss.usermodel.Workbook workbook, FontOption option)
workbook
- workbookoption
- optionpublic static org.apache.poi.ss.usermodel.PrintSetup parsePrint(org.apache.poi.ss.usermodel.Sheet sheet, PrintOption option)
sheet
- sheetoption
- optionpublic static void setLink(org.apache.poi.ss.usermodel.Workbook workbook, org.apache.poi.ss.usermodel.Cell cell, ExcelLinkType linkType, String address, ExcelFieldType textType, Object text)
workbook
- workbookcell
- celllinkType
- 链接类型address
- 链接地址textType
- 文本类型text
- 文本public static void setLink(org.apache.poi.ss.usermodel.Workbook workbook, org.apache.poi.ss.usermodel.Cell cell, ExcelLinkType linkType, String address, ExcelFieldType textType, CellOption option, Object text)
workbook
- workbookcell
- celllinkType
- 链接类型address
- 链接地址textType
- 文本类型text
- 文本public static org.apache.poi.ss.usermodel.Picture setPicture(org.apache.poi.ss.usermodel.Workbook workbook, org.apache.poi.ss.usermodel.Sheet sheet, File image, int rowIndex, int columnIndex)
workbook
- workbooksheet
- sheetimage
- 图片rowIndex
- 行索引columnIndex
- 列索引public static org.apache.poi.ss.usermodel.Picture setPicture(org.apache.poi.ss.usermodel.Workbook workbook, org.apache.poi.ss.usermodel.Sheet sheet, File image, int rowIndex, int columnIndex, String fileName)
workbook
- workbooksheet
- sheetimage
- 图片rowIndex
- 行索引columnIndex
- 列索引fileName
- 文件名public static org.apache.poi.ss.usermodel.Picture setPicture(org.apache.poi.ss.usermodel.Workbook workbook, org.apache.poi.ss.usermodel.Sheet sheet, File image, int rowIndex, int columnIndex, ExcelPictureType type)
workbook
- workbooksheet
- sheetimage
- 图片rowIndex
- 行索引columnIndex
- 列索引type
- 文件类型public static org.apache.poi.ss.usermodel.Picture setPicture(org.apache.poi.ss.usermodel.Workbook workbook, org.apache.poi.ss.usermodel.Sheet sheet, String image, int rowIndex, int columnIndex)
workbook
- workbooksheet
- sheetimage
- 图片rowIndex
- 行索引columnIndex
- 列索引public static org.apache.poi.ss.usermodel.Picture setPicture(org.apache.poi.ss.usermodel.Workbook workbook, org.apache.poi.ss.usermodel.Sheet sheet, String image, int rowIndex, int columnIndex, String fileName)
workbook
- workbooksheet
- sheetimage
- 图片rowIndex
- 行索引columnIndex
- 列索引fileName
- 文件名public static org.apache.poi.ss.usermodel.Picture setPicture(org.apache.poi.ss.usermodel.Workbook workbook, org.apache.poi.ss.usermodel.Sheet sheet, String image, int rowIndex, int columnIndex, ExcelPictureType type)
workbook
- workbooksheet
- sheetimage
- 图片rowIndex
- 行索引columnIndex
- 列索引type
- 文件类型public static org.apache.poi.ss.usermodel.Picture setPicture(org.apache.poi.ss.usermodel.Workbook workbook, org.apache.poi.ss.usermodel.Sheet sheet, InputStream image, int rowIndex, int columnIndex)
workbook
- workbooksheet
- sheetimage
- 图片rowIndex
- 行索引columnIndex
- 列索引public static org.apache.poi.ss.usermodel.Picture setPicture(org.apache.poi.ss.usermodel.Workbook workbook, org.apache.poi.ss.usermodel.Sheet sheet, InputStream image, int rowIndex, int columnIndex, String fileName)
workbook
- workbooksheet
- sheetimage
- 图片rowIndex
- 行索引columnIndex
- 列索引fileName
- 文件名public static org.apache.poi.ss.usermodel.Picture setPicture(org.apache.poi.ss.usermodel.Workbook workbook, org.apache.poi.ss.usermodel.Sheet sheet, InputStream image, int rowIndex, int columnIndex, ExcelPictureType type)
workbook
- workbooksheet
- sheetimage
- 图片rowIndex
- 行索引columnIndex
- 列索引type
- 文件类型public static org.apache.poi.ss.usermodel.Picture setPicture(org.apache.poi.ss.usermodel.Workbook workbook, org.apache.poi.ss.usermodel.Sheet sheet, byte[] image, int rowIndex, int columnIndex)
workbook
- workbooksheet
- sheetimage
- 图片rowIndex
- 行索引columnIndex
- 列索引public static org.apache.poi.ss.usermodel.Picture setPicture(org.apache.poi.ss.usermodel.Workbook workbook, org.apache.poi.ss.usermodel.Sheet sheet, byte[] image, int rowIndex, int columnIndex, String fileName)
workbook
- workbooksheet
- sheetimage
- 图片rowIndex
- 行索引columnIndex
- 列索引fileName
- 文件名public static org.apache.poi.ss.usermodel.Picture setPicture(org.apache.poi.ss.usermodel.Workbook workbook, org.apache.poi.ss.usermodel.Sheet sheet, byte[] image, int rowIndex, int columnIndex, ExcelPictureType type)
workbook
- workbooksheet
- sheetimage
- 图片rowIndex
- 行索引columnIndex
- 列索引type
- 文件类型public static org.apache.poi.ss.usermodel.Picture setPicture(org.apache.poi.ss.usermodel.Workbook workbook, org.apache.poi.ss.usermodel.Sheet sheet, byte[] image, int rowIndex, int columnIndex, String fileName, ExcelPictureType type)
workbook
- workbooksheet
- sheetimage
- 图片rowIndex
- 行索引columnIndex
- 列索引fileName
- 文件名type
- 文件类型public static void freezeFirstRow(org.apache.poi.ss.usermodel.Sheet sheet)
sheet
- sheetpublic static void freezeRow(org.apache.poi.ss.usermodel.Sheet sheet, int lastRow)
sheet
- sheetlastRow
- 结束行索引 不包含public static void filterFirstRow(org.apache.poi.ss.usermodel.Sheet sheet)
sheet
- sheetpublic static void filterFirstRow(org.apache.poi.ss.usermodel.Sheet sheet, int lastColumn)
sheet
- sheetlastColumn
- 结束列索引public static void filterFirstRow(org.apache.poi.ss.usermodel.Sheet sheet, int firstColumn, int lastColumn)
sheet
- sheetfirstColumn
- 开始列索引lastColumn
- 结束列索引public static void filterRow(org.apache.poi.ss.usermodel.Sheet sheet, int rowIndex)
sheet
- sheetrowIndex
- 行索引public static void filterRow(org.apache.poi.ss.usermodel.Sheet sheet, int rowIndex, int lastColumn)
sheet
- sheetrowIndex
- 行索引lastColumn
- 结束列索引public static void filterRow(org.apache.poi.ss.usermodel.Sheet sheet, int rowIndex, int firstColumn, int lastColumn)
sheet
- sheetrowIndex
- 行索引firstColumn
- 开始列索引lastColumn
- 结束列索引public static org.apache.poi.ss.util.CellRangeAddress mergeCellRange(int row, int firstColumn, int lastColumn)
row
- 合并行索引firstColumn
- 合并开始列索引lastColumn
- 合并结束列索引public static org.apache.poi.ss.util.CellRangeAddress mergeCellRange(int firstRow, int lastRow, int firstColumn, int lastColumn)
firstRow
- 合并开始行索引lastRow
- 合并结束行索引firstColumn
- 合并开始列索引lastColumn
- 合并结束列索引public static void mergeCell(org.apache.poi.ss.usermodel.Sheet sheet, int row, int firstColumn, int lastColumn)
sheet
- sheetrow
- 合并行索引firstColumn
- 合并开始列索引lastColumn
- 合并结束列索引public static void mergeCell(org.apache.poi.ss.usermodel.Sheet sheet, int firstRow, int lastRow, int firstColumn, int lastColumn)
sheet
- sheetfirstRow
- 合并开始行索引lastRow
- 合并结束行索引firstColumn
- 合并开始列索引lastColumn
- 合并结束列索引public static void mergeCell(org.apache.poi.ss.usermodel.Sheet sheet, org.apache.poi.ss.util.CellRangeAddress region)
sheet
- sheetregion
- regionpublic static void mergeCellBorder(org.apache.poi.ss.usermodel.Sheet sheet, int borderCode, int colorIndex, int row, int firstColumn, int lastColumn)
sheet
- sheetborderCode
- 边框colorIndex
- 颜色row
- 合并行索引firstColumn
- 合并开始列索引lastColumn
- 合并结束列索引public static void mergeCellBorder(org.apache.poi.ss.usermodel.Sheet sheet, int borderCode, int colorIndex, int firstRow, int lastRow, int firstColumn, int lastColumn)
sheet
- sheetborderCode
- 边框firstRow
- 合并开始行索引lastRow
- 合并结束行索引firstColumn
- 合并开始列索引lastColumn
- 合并结束列索引public static void mergeCellBorder(org.apache.poi.ss.usermodel.Sheet sheet, int borderCode, int colorIndex, org.apache.poi.ss.util.CellRangeAddress region)
sheet
- sheetborderCode
- 边框region
- regionpublic static void addSelectOptions(org.apache.poi.ss.usermodel.Sheet sheet, int column, String[] options)
sheet
- sheetcolumn
- 开始列索引options
- 选项public static void addSelectOptions(org.apache.poi.ss.usermodel.Sheet sheet, int startRow, int column, String[] options)
sheet
- sheetstartRow
- 开始行索引column
- 开始列索引options
- 选项public static void addSelectOptions(org.apache.poi.ss.usermodel.Sheet sheet, int startRow, int endRow, int column, String[] options)
sheet
- sheetstartRow
- 开始行索引endRow
- 结束行索引column
- 列索引options
- 选项public static void addSelectOptions(org.apache.poi.ss.usermodel.Sheet sheet, int startRow, int endRow, int startColumn, int endColumn, String[] options)
sheet
- sheetstartRow
- 开始行索引endRow
- 结束行索引startColumn
- 开始列索引endColumn
- 结束列索引options
- 选项public static void write(org.apache.poi.ss.usermodel.Workbook workbook, String file)
public static void write(org.apache.poi.ss.usermodel.Workbook workbook, File file)
public static void write(org.apache.poi.ss.usermodel.Workbook workbook, OutputStream out)
public static void write(org.apache.poi.ss.usermodel.Workbook workbook, OutputStream out, boolean close)
workbook
- workbookout
- 流close
- 是否关闭流public static void write(org.apache.poi.ss.usermodel.Workbook workbook, String file, String password)
public static void write(org.apache.poi.ss.usermodel.Workbook workbook, File file, String password)
public static void write(org.apache.poi.ss.usermodel.Workbook workbook, OutputStream out, String password)
public static void write(org.apache.poi.ss.usermodel.Workbook workbook, OutputStream out, String password, boolean close)
workbook
- workbookout
- 流password
- passwordclose
- 是否关闭流public static void close(org.apache.poi.ss.usermodel.Workbook workbook)
workbook
- workbookpublic static SheetCopier copySheet(org.apache.poi.ss.usermodel.Workbook resourceWorkbook, org.apache.poi.ss.usermodel.Workbook targetWorkbook, int resourceIndex)
resourceWorkbook
- 源表targetWorkbook
- 目标表resourceIndex
- 源sheet索引public static SheetCopier copySheet(org.apache.poi.ss.usermodel.Workbook resourceWorkbook, org.apache.poi.ss.usermodel.Workbook targetWorkbook, int resourceIndex, int targetIndex)
resourceWorkbook
- 源表targetWorkbook
- 目标表resourceIndex
- 源sheet索引targetIndex
- 目标sheet索引public static org.apache.poi.ss.usermodel.Workbook openWorkbook(InputStream in)
public static org.apache.poi.ss.usermodel.Workbook openWorkbook(String file)
public static org.apache.poi.ss.usermodel.Workbook openWorkbook(File file)
public static org.apache.poi.ss.usermodel.Workbook openWorkbook(String file, String password)
public static org.apache.poi.ss.usermodel.Workbook openWorkbook(File file, String password)
public static org.apache.poi.ss.usermodel.Workbook openWorkbook(InputStream in, String password)
in
- 文件流public static org.apache.poi.ss.usermodel.Workbook openStreamingWorkbook(String file)
public static org.apache.poi.ss.usermodel.Workbook openStreamingWorkbook(File file)
public static org.apache.poi.ss.usermodel.Workbook openStreamingWorkbook(InputStream in)
public static org.apache.poi.ss.usermodel.Workbook openStreamingWorkbook(String file, String password)
public static org.apache.poi.ss.usermodel.Workbook openStreamingWorkbook(File file, String password)
public static org.apache.poi.ss.usermodel.Workbook openStreamingWorkbook(InputStream in, String password)
public static org.apache.poi.ss.usermodel.Workbook openStreamingWorkbook(String file, int rowCache)
public static org.apache.poi.ss.usermodel.Workbook openStreamingWorkbook(File file, int rowCache)
public static org.apache.poi.ss.usermodel.Workbook openStreamingWorkbook(InputStream in, int rowCache)
public static org.apache.poi.ss.usermodel.Workbook openStreamingWorkbook(String file, String password, int rowCache)
public static org.apache.poi.ss.usermodel.Workbook openStreamingWorkbook(File file, String password, int rowCache)
public static org.apache.poi.ss.usermodel.Workbook openStreamingWorkbook(InputStream in, String password, int rowCache)
public static org.apache.poi.ss.usermodel.Workbook openStreamingWorkbook(String file, int rowCache, int bufferSize)
public static org.apache.poi.ss.usermodel.Workbook openStreamingWorkbook(File file, int rowCache, int bufferSize)
public static org.apache.poi.ss.usermodel.Workbook openStreamingWorkbook(InputStream in, int rowCache, int bufferSize)
public static org.apache.poi.ss.usermodel.Workbook openStreamingWorkbook(String file, String password, int rowCache, int bufferSize)
public static org.apache.poi.ss.usermodel.Workbook openStreamingWorkbook(File file, String password, int rowCache, int bufferSize)
public static org.apache.poi.ss.usermodel.Workbook openStreamingWorkbook(InputStream in, String password, int rowCache, int bufferSize)
in
- 文件流password
- 密码rowCache
- row缓存bufferSize
- 缓冲区大小public static boolean isStreamingWorkbook(org.apache.poi.ss.usermodel.Workbook workbook)
workbook
- workbookpublic static boolean isStreamingWorkbook(Class<?> clazz)
clazz
- workbook classpublic static boolean isStreamingSheet(org.apache.poi.ss.usermodel.Sheet sheet)
sheet
- sheetpublic static boolean isStreamingSheet(Class<?> clazz)
clazz
- sheet classCopyright © 2024. All rights reserved.