public interface Sheet extends Closeable
| 限定符和类型 | 方法和说明 |
|---|---|
default Sheet |
addHeaderColumnReadOption(int option)
Add header columns preprocessing properties
|
CalcSheet |
asCalcSheet()
Make worksheets parse formulas
|
MergeSheet |
asMergeSheet()
Make worksheets copy value on merge cells
|
Sheet |
asSheet()
Make worksheets parse value only
|
Sheet |
bind(Class<?> clazz)
Set the binding type
|
default Sheet |
bind(Class<?> clazz,
int fromRowNum)
Set the binding type
|
default Sheet |
bind(Class<?> clazz,
int fromRowNum,
int toRowNum)
Set the binding type
|
Sheet |
bind(Class<?> clazz,
Row row)
Set the binding type
|
void |
close()
Close resource
|
static int |
col2Int(String col)
Convert column mark to int
|
Row |
createRow()
Create a
Row to read |
Iterator<Row> |
dataIterator()
Iterating over data rows without header information and blank lines
|
default Stream<Row> |
dataRows()
Return stream with out header row and empty rows
|
default Sheet |
forceImport()
Use field name matching without
ExcelColumn annotation
When converting row data to Java objects, only fields with ExcelColumn annotations
are matched by default. |
Dimension |
getDimension()
Returns The range address of the used area in
the current sheet
NOTE: This method can only guarantee accurate row ranges
|
Row |
getHeader()
Returns the header of the list.
|
int |
getHeaderColumnReadOption()
Returns Header column options
|
int |
getId()
The worksheet id, it difference with index is that the id will not change
because of moving or deleting worksheet.
|
int |
getIndex()
The index of worksheet located at the workbook
|
String |
getName()
The worksheet name
|
int |
getSize()
已过时。
use
getDimension() to getting full range address |
default Sheet |
header(int fromRowNum)
Specify the header rows endpoint
|
Sheet |
header(int fromRowNum,
int toRowNum)
Specify the header rows endpoint
Note: After specifying the header row number, the row-pointer will move to the
next row of the header range.
|
default Sheet |
headerColumnIgnoreCase()
Settings ignore case matching column names
|
default Sheet |
headerColumnToCamelCase()
Convert column name to camel case
|
boolean |
isHidden()
Test Worksheet is hidden
|
default boolean |
isShow()
Test Worksheet is show
|
Iterator<Row> |
iterator()
Iterating each row of data contains header information and blank lines
|
List<Drawings.Picture> |
listPictures()
List all pictures in workbook
|
Sheet |
load()
Load the sheet data
|
default Sheet |
reset()
Reset the
Sheet's row index to begging |
default Stream<Row> |
rows()
Return a stream of all rows
|
default void |
saveAsCSV(BufferedWriter bw)
Save file as Comma-Separated Values.
|
default void |
saveAsCSV(OutputStream os)
Save file as Comma-Separated Values.
|
default void |
saveAsCSV(OutputStream os,
Charset charset)
Save file as Comma-Separated Values.
|
default void |
saveAsCSV(Path path)
Save file as Comma-Separated Values.
|
default void |
saveAsCSV(Path path,
Charset charset)
Save file as Comma-Separated Values.
|
Sheet |
setHeaderColumnReadOption(int option)
Setting header columns preprocessing properties
HeaderRow.FORCE_IMPORT: Match with field name if without ExcelColumn annotation
HeaderRow.IGNORE_CASE: Ignore case matching column names
HeaderRow.CAMEL_CASE: CAMEL_CASE to camelCase
reader.sheet(0).setHeaderColumnReadOption(HeaderRow.FORCE_IMPORT | HeaderRow.IGNORE_CASE)
|
String getName()
int getIndex()
int getId()
@Deprecated int getSize()
getDimension() to getting full range addressDimension getDimension()
NOTE: This method can only guarantee accurate row ranges
Dimension rangesboolean isHidden()
default boolean isShow()
default Sheet header(int fromRowNum)
fromRowNum - low endpoint (inclusive) of the worksheet (one base)SheetIndexOutOfBoundsException - if fromRow less than 1Sheet header(int fromRowNum, int toRowNum)
Note: After specifying the header row number, the row-pointer will move to the
next row of the header range. The bind(Class), bind(Class, int),
bind(Class, int, int), rows(), dataRows(), iterator(),
and dataIterator() will all be affected.
fromRowNum - low endpoint (inclusive) of the worksheet (one base)toRowNum - high endpoint (inclusive) of the worksheet (one base)SheetIndexOutOfBoundsException - if fromRow less than 1IllegalArgumentException - if toRow less than fromRowRow getHeader()
header(int, int)
to specify multiple header rows. If there are multiple rows of headers, ':' will be used for stitching.
The above table will return "TITLE", "COMMON:SUB1", "COMMON:SUB2", "COMMON:SUB3"+-----------------------------+ | | COMMON | | TITLE +-------+------+------+ | | SUB1 | SUB2 | SUB3 | +------+-------+-------+------+
HeaderRowdefault Sheet bind(Class<?> clazz, int fromRowNum)
clazz - the binding typefromRowNum - low endpoint (inclusive) of the worksheet (one base)Sheetdefault Sheet bind(Class<?> clazz, int fromRowNum, int toRowNum)
clazz - the binding typefromRowNum - low endpoint (inclusive) of the worksheet (one base)toRowNum - high endpoint (inclusive) of the worksheet (one base)SheetSheet bind(Class<?> clazz, Row row)
clazz - the binding typerow - specify a custom header rowSheetSheet load() throws IOException
SheetIOException - if I/O error occurIterator<Row> iterator()
Iterator<Row> dataIterator()
List<Drawings.Picture> listPictures()
default Sheet reset()
Sheet's row index to beggingSheetExcelReadException - if I/O error occur.UnsupportedOperationException - if sub-class un-implement this function.default Stream<Row> rows()
Stream<Row> providing the lines of row
described by this Sheetdefault Stream<Row> dataRows()
Stream<Row> providing the lines of row
described by this Sheetstatic int col2Int(String col)
col - column markvoid close()
throws IOException
close 在接口中 AutoCloseableclose 在接口中 CloseableIOException - if I/O error occurdefault void saveAsCSV(Path path) throws IOException
path - the output storage pathIOException - if I/O error occur.default void saveAsCSV(Path path, Charset charset) throws IOException
path - the output storage pathcharset - specify a charset, default is UTF-8IOException - if I/O error occur.default void saveAsCSV(OutputStream os) throws IOException
os - the outputIOException - if I/O error occur.default void saveAsCSV(OutputStream os, Charset charset) throws IOException
os - the outputcharset - specify a charsetIOException - if I/O error occur.default void saveAsCSV(BufferedWriter bw) throws IOException
bw - buffer writerIOException - if I/O error occur.default Sheet forceImport()
ExcelColumn annotation
When converting row data to Java objects, only fields with ExcelColumn annotations
are matched by default. forceImport will skip this restriction,
and fields without ExcelColumn annotations will be matched with field name
Sheetdefault Sheet headerColumnIgnoreCase()
Sheetdefault Sheet headerColumnToCamelCase()
Sheetdefault Sheet addHeaderColumnReadOption(int option)
option - header column optionsSheetSheet setHeaderColumnReadOption(int option)
reader.sheet(0).setHeaderColumnReadOption(HeaderRow.FORCE_IMPORT | HeaderRow.IGNORE_CASE)
option - header column optionsSheetint getHeaderColumnReadOption()
SheetMergeSheet asMergeSheet()
MergeSheetCopyright © 2023. All rights reserved.