public class ListSheet<T> extends Sheet
ListSheet, and then override the more()
method to achieve segmented loading of data. The more()
method returns NULL or an empty array to complete the current
worksheet writeListMapSheet| 限定符和类型 | 类和说明 |
|---|---|
static class |
ListSheet.EntryColumn |
Sheet.Column| 限定符和类型 | 字段和说明 |
|---|---|
protected List<T> |
data |
protected int |
end |
protected boolean |
eof |
protected int |
start |
protected StyleProcessor<T> |
styleProcessor
The row styleProcessor
|
autoOdd, autoSize, cellValueAndStyle, columns, comments, copyCount, copySheet, extProp, extPropMark, forceExport, headerReady, headStyle, headStyleIndex, hidden, id, LOGGER, name, nonHeader, oddFill, relManager, rowBlock, rows, sheetWriter, shouldClose, waterMark, width, workbook| 构造器和说明 |
|---|
ListSheet()
Constructor worksheet
|
ListSheet(List<T> data)
Constructor worksheet
|
ListSheet(List<T> data,
Column... columns)
Constructor worksheet
|
ListSheet(List<T> data,
WaterMark waterMark,
Column... columns)
Constructor worksheet
|
ListSheet(String name)
Constructor worksheet
|
ListSheet(String name,
Column... columns)
Constructor worksheet
|
ListSheet(String name,
List<T> data)
Constructor worksheet
|
ListSheet(String name,
List<T> data,
Column... columns)
Constructor worksheet
|
ListSheet(String name,
List<T> data,
WaterMark waterMark,
Column... columns)
Constructor worksheet
|
ListSheet(String name,
WaterMark waterMark,
Column... columns)
Constructor worksheet
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
append()
Call this method to get more data when the data length
less than the row-block size until there is no more data
or more than the row limit
|
protected void |
attachFreezePanes(Class<?> clazz)
Parse and attach freeze info
|
protected List<Column> |
attachOtherColumn(Map<String,Method> existsMethodMapper,
Class<?> clazz)
Attach some custom columns
|
protected void |
buildHeaderComment(AccessibleObject main,
AccessibleObject sub,
Column column)
Build header comment
|
protected void |
buildHeaderStyle(AccessibleObject main,
AccessibleObject sub,
Column column)
Build header style
|
void |
close()
Release resources
|
protected ListSheet.EntryColumn |
createColumn(AccessibleObject ao)
Create column from
ExcelColumn annotation
Override the method to extend custom comments |
int |
dataSize()
Returns total data size before split
|
protected Method[] |
filterOthersMethodsCanExport(Map<String,Method> existsMethodMapper,
Class<?> clazz)
Filter methods that need to be exported
|
protected StyleProcessor<?> |
getDesignStyle(StyleDesign styleDesign)
Set custom styleProcessor for declarations on Entry Class
|
protected int |
getEndIndex()
Returns the end index of row-block
|
protected T |
getFirst()
Returns the first not null object
|
protected Column[] |
getHeaderColumns()
Returns the header column info
|
StyleProcessor<T> |
getStyleProcessor()
Returns the row style processor
|
protected Class<?> |
getTClass() |
protected boolean |
ignoreColumn(AccessibleObject ao)
Ignore some columns, override this method to add custom filtering
|
protected int |
init()
Get the first object of the object array witch is not NULL,
reflect all declared fields, and then do the following steps
step 1.
|
protected int |
left()
Returns left data in array to be write
|
protected void |
mergeGlobalSetting(Class<?> clazz)
Merge Header Style defined on Entry Class
|
protected List<T> |
more()
This method is used for the worksheet to get the data.
|
protected void |
paging()
Split worksheet data
|
protected void |
resetBlockData()
Reset the row-block data
|
ListSheet<T> |
setData(List<T> data)
Setting the worksheet data
|
Sheet |
setStyleProcessor(StyleProcessor<T> styleProcessor)
Setting a row style processor
|
int |
size()
Returns total rows in this worksheet
|
addRel, afterSheetAccess, autoSize, buildHeadStyle, cancelForceExport, cancelOddStyle, checkColumnLimit, clone, createComments, defaultHeadStyle, defaultHeadStyleIndex, findRel, fixSize, fixSize, forceExport, getAndSortHeaderColumns, getAutoOdd, getAutoSize, getComments, getCopySheetName, getDefaultWidth, getExtPropAsMap, getExtPropValue, getFileName, getForceExport, getHeadStyle, getHeadStyleIndex, getId, getName, getNonHeader, getOddFill, getRowBlockSize, getRowLimit, getSst, getWaterMark, getWorkbook, hasHeaderColumns, hidden, ignoreHeader, int2Col, isAutoSize, isHidden, markExtProp, nextBlock, nonOrIntDefault, putAllExtProp, putExtProp, putExtPropIfAbsent, resetCommonProperties, search, setAutoOdd, setCellValueAndStyle, setColumns, setHeadStyle, setHeadStyle, setHeadStyle, setHeadStyle, setHeadStyleIndex, setId, setName, setOddFill, setSheetWriter, setWaterMark, setWorkbook, sortColumns, what, what, writeToprotected int start
protected int end
protected boolean eof
protected StyleProcessor<T> styleProcessor
public ListSheet()
public ListSheet(String name)
name - the worksheet namepublic ListSheet(String name, Column... columns)
name - the worksheet namecolumns - the header infopublic ListSheet(String name, WaterMark waterMark, Column... columns)
name - the worksheet namewaterMark - the water markcolumns - the header infopublic ListSheet(String name, List<T> data)
name - the worksheet namedata - the worksheet's body datapublic ListSheet(List<T> data, Column... columns)
data - the worksheet's body datacolumns - the header infopublic ListSheet(String name, List<T> data, Column... columns)
name - the worksheet namedata - the worksheet's body datacolumns - the header infopublic ListSheet(List<T> data, WaterMark waterMark, Column... columns)
data - the worksheet's body datawaterMark - the water markcolumns - the header infopublic Sheet setStyleProcessor(StyleProcessor<T> styleProcessor)
styleProcessor - a row style processorpublic StyleProcessor<T> getStyleProcessor()
StyleProcessorpublic ListSheet<T> setData(List<T> data)
data - the body dataprotected T getFirst()
public void close()
throws IOException
close 在类中 SheetIOException - if I/O error occurprotected void resetBlockData()
resetBlockData 在类中 Sheetprotected void append()
protected Class<?> getTClass()
protected int init()
step 1. If the method has ExcelColumn annotation, the value of
this annotation is used as the column name.
step 2. If the ExcelColumn annotation has no value or empty value,
the field name is used as the column name.
step 3. If the field has ExcelColumn annotation, the value of
this annotation is used as the column name.
step 4. Skip this Field if it has a IgnoreExport annotation,
or the field which has not ExcelColumn annotation.
The column order is the same as the order in declared fields.
protected ListSheet.EntryColumn createColumn(AccessibleObject ao)
ExcelColumn annotation
Override the method to extend custom comments
ao - AccessibleObject witch defined the ExcelColumn annotationColumn informationprotected void buildHeaderStyle(AccessibleObject main, AccessibleObject sub, Column column)
main - the getter methodsub - the defined fieldcolumn - the header columnprotected void buildHeaderComment(AccessibleObject main, AccessibleObject sub, Column column)
main - the getter methodsub - the defined fieldcolumn - the header columnprotected void mergeGlobalSetting(Class<?> clazz)
clazz - Class of <T>protected StyleProcessor<?> getDesignStyle(StyleDesign styleDesign)
styleDesign - StyleDesignprotected boolean ignoreColumn(AccessibleObject ao)
ao - Method or Fieldprotected List<Column> attachOtherColumn(Map<String,Method> existsMethodMapper, Class<?> clazz)
existsMethodMapper - all exists method collection by defaultclazz - Class of <T>Column or null if no more columns to attachprotected Column[] getHeaderColumns()
getHeaderColumns 在类中 Sheetprotected int getEndIndex()
public int size()
protected int left()
public int dataSize()
protected List<T> more()
The more data you get each time, the faster write speed. You
should minimize the database query or network request, but the
excessive data will put pressure on the memory. Please balance
this value between the speed and memory. You can refer to 2^8 ~ 2^10
This method is blocked
protected void attachFreezePanes(Class<?> clazz)
clazz - Class of <T>Copyright © 2022. All rights reserved.