类 SheetConfig
java.lang.Object
gu.sql2java.excel.config.SheetConfig
Excel表输出全局配置
- 作者:
- guyadong
-
构造器概要
构造器构造器说明默认构造方法SheetConfig(ExcelSheet sheetAnnot, ExcelColumn... columnAnnots) SheetConfig(gu.sql2java.RowMetaData metaData) 构造方法支持UnnameRow记录SheetConfig(Class<?> beanClass) 构造方法,支持普通JavaBean类型SheetConfig(Iterable<Map> iterable) 构造方法,支持Map类型的记录对象包括JSONObjectSheetConfig(Iterable<Map> iterable, Iterable<String> includeCoumns) 构造方法,支持Map类型的记录对象包括JSONObjectSheetConfig(Object bean) 构造方法,支持普通JavaBean实例SheetConfig(Method method) 构造方法,支持从服务方法中获取注解完成配置
如果方法中定义了ExcelSheet注解,注解中定义了beanClass,则调用SheetConfig(Class)构造方法基于JavaBean类型构造当前实例,再调用SheetConfig(Method)构造方法基于方法构造一个临时实例, 将临时实例合并到当前实例 -
方法概要
修饰符和类型方法说明addColumns(PropertyConfig... elements) addColumns(Iterable<PropertyConfig> elements) addNestedColumn(String nestedName, String descName) addNestedColumns(Iterable<String> elements) addNestedColumns(String... elements) configByExcelName(String excelName) 根据EXCEL输出字段名名查找对应的属性配置对象,没找到返回null,如果有多个匹配返回第一个根据属性路径名查找对应的属性配置对象,没找到返回则创建一个默认对象
查找时如果没有找到完全匹配的值会自动切换节点名为驼峰命名格式或蛇形命名格式尝试configOrNullOf(String nestedName) 根据属性路径名查找对应的属性配置对象,没找到返回nullboolean返回所有可输出字段及字段显示名称Class<?>返回所有字段配置对象根据defaultIncludeColumns过滤返回默认输出的字段名根据defaultIncludeColumns过滤返回默认输出的字段名和Excel导出时的列名返回所有EXCEL字段名称-PropertyConfig映射返回需要导出的字段列表
如果字段输出白名单(includeColumns)不为空则返回此名单中的字段配置对象 如果字段输出黑名单excludeColumns不为空则返回不在此名单中的所有字段配置对象 否则返回所有字段;org.apache.poi.ss.usermodel.IndexedColorsorg.apache.poi.ss.usermodel.IndexedColorsshortorg.apache.poi.ss.usermodel.IndexedColorsorg.apache.poi.ss.usermodel.IndexedColorsshortorg.apache.poi.ss.usermodel.HorizontalAlignmentorg.apache.poi.ss.usermodel.HorizontalAlignment返回需要导出的字段列表
如果字段输出黑名单excludeColumns不为空则返回不在此名单中的所有字段配置对象 否则返回所有字段;intint返回所有嵌入字段intintshort根据注解获取最大行高intgetScale()getTitle()org.apache.poi.ss.usermodel.IndexedColorsorg.apache.poi.ss.usermodel.IndexedColorsshortorg.apache.poi.ss.usermodel.HorizontalAlignmentlongbooleanstatic booleanmayBeJavaBean(Class<?> type) merge(SheetConfig other) 将输入的Excel表配置与当前对象的合并
将other中有定义的Excel Sheet配置字段复制到当前对象的对应字段
将other定义的Excel Column配置对象(PropertyConfig)合并到当前的Column配置对象中,如果存在相同的对象,则以other的为准,
如果other.beanClass不为null则复制到当前对象的同名字段voidsetBeanClass(Class<?> beanClass) setColumnConfigs(Iterable<PropertyConfig> columnConfigs) voidsetCustomImporter(CustomBeanParser customImporter) voidsetCustomImporter(Class<? extends CustomBeanParser> customImporterClass) setDateFormat(String dateFormat) setDateTimeFormat(String dateTimeFormat) voidsetDefaultIncludeColumns(Iterable<String> defaultIncludeColumns) voidsetDefaultIncludeColumns(String... defaultIncludeColumns) setDefaultIncludeColumns(Set<String> defaultIncludeColumns) setDefaultValue(String defaultValue) voidsetDynamicExcelNames(Set<String> dynamicExcelNames) setExcludeColumns(Iterable<String> excludeColumns) 指定输出时要排序的字段(黑名单),在此名单中的字段不被输出setExcludeColumns(String... excludeColumns) setExcludeColumns(Set<String> excludeColumns) setFileNamePrefix(String fileNamePrefix) setFillColor(String fillColor) setFillColor(org.apache.poi.ss.usermodel.IndexedColors fillColor) setFirstBold(boolean firstBold) setFirstBold(Boolean firstBold) setFontColor(String fontColor) setFontColor(org.apache.poi.ss.usermodel.IndexedColors fontColor) setFontHeight(short fontHeight) setFontHeight(Integer fontHeight) setFontName(String fontName) setHeaderFillColor(String headerFillColor) setHeaderFillColor(org.apache.poi.ss.usermodel.IndexedColors headerFillColor) setHeaderFontColor(String headerFontColor) setHeaderFontColor(org.apache.poi.ss.usermodel.IndexedColors headerFontColor) setHeaderFontHeight(short headerFontHeight) setHeaderFontHeight(Integer headerFontHeight) setHeaderFontName(String headerFontName) setHeaderHorizontalAlign(String headerHorizontalAlign) setHeaderHorizontalAlign(org.apache.poi.ss.usermodel.HorizontalAlignment headerHorizontalAlign) setHideColumns(Iterable<String> hideColumns) setHideColumns(String... hideColumns) setHideColumns(Set<String> hideColumns) setHorizontalAlign(String horizontalAlign) setHorizontalAlign(org.apache.poi.ss.usermodel.HorizontalAlignment horizontalAlign) setIncludeColumns(Iterable<String> includeColumns) 指定要输出的字段(白名单),在此名单中的字段才会被输出, 此方法也定义了字段输出顺序,setIncludeColumns(String... includeColumns) setIncludeColumns(Set<String> includeColumns) setIncludeColumnsOrDefault(Iterable<String> includeColumns) 指定要输出的字段(白名单),如果输入参数为null或空,则使用getDefaultExportColumnNames()的返回值setIntegralFormat(String integralFormat) setMaxHeight(int maxHeight) setMaxHeight(Integer maxHeight) setMaxWidth(int maxWidth) setMaxWidth(Integer maxWidth) voidsetQueueTimeout(int queueTimeout) setRoundingMode(int roundingMode) setScale(int scale) setSheetName(String sheetName) setTimeFormat(String timeFormat) setTimestampFormat(String timestampFormat) setTitleFillColor(String titleFillColor) setTitleFillColor(org.apache.poi.ss.usermodel.IndexedColors titleFillColor) setTitleFontColor(String titleFontColor) setTitleFontColor(org.apache.poi.ss.usermodel.IndexedColors titleFontColor) setTitleFontHeight(short titleFontHeight) setTitleFontHeight(Integer titleFontHeight) setTitleFontName(String titleFontName) setTitleHorizontalAlign(String titleHorizontalAlign) setTitleHorizontalAlign(org.apache.poi.ss.usermodel.HorizontalAlignment titleHorizontalAlign) voidsetTotalRowCount(long totalRowCount)
-
构造器详细资料
-
SheetConfig
public SheetConfig()默认构造方法 -
SheetConfig
- 参数:
sheetAnnot-columnAnnots-
-
SheetConfig
构造方法,支持从服务方法中获取注解完成配置
如果方法中定义了ExcelSheet注解,注解中定义了beanClass,则调用SheetConfig(Class)构造方法基于JavaBean类型构造当前实例,再调用SheetConfig(Method)构造方法基于方法构造一个临时实例, 将临时实例合并到当前实例- 参数:
method-
-
SheetConfig
构造方法,支持普通JavaBean类型- 参数:
beanClass-
-
SheetConfig
public SheetConfig(gu.sql2java.RowMetaData metaData) 构造方法支持UnnameRow记录- 参数:
metaData-
-
SheetConfig
构造方法,支持普通JavaBean实例- 参数:
bean-
-
SheetConfig
构造方法,支持Map类型的记录对象包括JSONObject- 参数:
iterable-
-
SheetConfig
构造方法,支持Map类型的记录对象包括JSONObject- 参数:
iterable-includeCoumns-
-
-
方法详细资料
-
getSheetName
-
setSheetName
-
getFileNamePrefix
- 返回:
- fileNamePrefix
-
setFileNamePrefix
- 参数:
fileNamePrefix- 要设置的 fileNamePrefix- 返回:
- 当前对象
-
getTitle
-
setTitle
-
getTitleFontName
-
setTitleFontName
-
getTitleFontHeight
public short getTitleFontHeight() -
setTitleFontHeight
-
setTitleFontHeight
-
getTitleFontColor
public org.apache.poi.ss.usermodel.IndexedColors getTitleFontColor() -
setTitleFontColor
-
setTitleFontColor
-
getTitleFillColor
public org.apache.poi.ss.usermodel.IndexedColors getTitleFillColor() -
setTitleFillColor
-
setTitleFillColor
-
getTitleHorizontalAlign
public org.apache.poi.ss.usermodel.HorizontalAlignment getTitleHorizontalAlign()- 返回:
- titleHorizontalAlign
-
setTitleHorizontalAlign
public SheetConfig setTitleHorizontalAlign(org.apache.poi.ss.usermodel.HorizontalAlignment titleHorizontalAlign) - 参数:
titleHorizontalAlign- 要设置的 titleHorizontalAlign- 返回:
- 当前对象
-
setTitleHorizontalAlign
- 参数:
titleHorizontalAlign- 要设置的 titleHorizontalAlign- 返回:
- 当前对象
-
getHeaderFontName
-
setHeaderFontName
-
getHeaderFontHeight
public short getHeaderFontHeight() -
setHeaderFontHeight
-
setHeaderFontHeight
-
getHeaderFontColor
public org.apache.poi.ss.usermodel.IndexedColors getHeaderFontColor() -
setHeaderFontColor
-
setHeaderFontColor
-
getHeaderFillColor
public org.apache.poi.ss.usermodel.IndexedColors getHeaderFillColor() -
setHeaderFillColor
-
setHeaderFillColor
-
getHeaderHorizontalAlign
public org.apache.poi.ss.usermodel.HorizontalAlignment getHeaderHorizontalAlign()- 返回:
- headerHorizontalAlign
-
setHeaderHorizontalAlign
public SheetConfig setHeaderHorizontalAlign(org.apache.poi.ss.usermodel.HorizontalAlignment headerHorizontalAlign) - 参数:
headerHorizontalAlign- 要设置的 headerHorizontalAlign- 返回:
- 当前对象
-
setHeaderHorizontalAlign
- 参数:
headerHorizontalAlign- 要设置的 headerHorizontalAlign- 返回:
- 当前对象
-
isFirstBold
public boolean isFirstBold() -
setFirstBold
-
setFirstBold
-
getFontHeight
public short getFontHeight() -
setFontHeight
-
setFontHeight
-
getFontName
-
setFontName
-
getFontColor
public org.apache.poi.ss.usermodel.IndexedColors getFontColor() -
setFontColor
-
setFontColor
-
getFillColor
public org.apache.poi.ss.usermodel.IndexedColors getFillColor() -
setFillColor
-
setFillColor
-
getHorizontalAlign
public org.apache.poi.ss.usermodel.HorizontalAlignment getHorizontalAlign() -
setHorizontalAlign
public SheetConfig setHorizontalAlign(org.apache.poi.ss.usermodel.HorizontalAlignment horizontalAlign) -
setHorizontalAlign
-
getIntegralFormat
-
setIntegralFormat
-
getDateTimeFormat
-
setDateTimeFormat
-
getDateFormat
-
setDateFormat
-
getTimeFormat
-
setTimeFormat
-
getTimestampFormat
-
setTimestampFormat
-
getScale
public int getScale() -
setScale
-
getRoundingMode
public int getRoundingMode() -
setRoundingMode
-
getMaxWidth
public int getMaxWidth() -
setMaxWidth
-
setMaxWidth
-
getMaxHeight
public int getMaxHeight() -
setMaxHeight
-
setMaxHeight
-
getDefaultValue
-
setDefaultValue
-
getIncludeColumns
- 返回:
- 字段输出白名单
-
setIncludeColumns
-
setIncludeColumns
指定要输出的字段(白名单),在此名单中的字段才会被输出, 此方法也定义了字段输出顺序,- 参数:
includeColumns-- 返回:
- 当前对象
-
setIncludeColumns
-
getExcludeColumns
- 返回:
- 字段输出黑名单
-
setExcludeColumns
-
setExcludeColumns
指定输出时要排序的字段(黑名单),在此名单中的字段不被输出- 参数:
excludeColumns-- 返回:
- 当前对象
-
setExcludeColumns
-
getNestedNames
返回所有嵌入字段- 从以下版本开始:
- 3.29.4
-
getHideColumns
- 返回:
- hideColumns
-
setHideColumns
- 参数:
hideColumns- 要设置的 hideColumns- 返回:
- 当前对象
-
setHideColumns
- 参数:
hideColumns- 要设置的 hideColumns- 另请参阅:
-
setHideColumns
- 参数:
hideColumns- 要设置的 hideColumns- 返回:
- 当前对象
-
getDefaultIncludeColumns
- 返回:
- defaultIncludeColumns
-
setDefaultIncludeColumns
- 参数:
defaultIncludeColumns- 要设置的 defaultIncludeColumns
-
setDefaultIncludeColumns
- 参数:
defaultIncludeColumns- 要设置的 defaultIncludeColumns
-
setDefaultIncludeColumns
- 参数:
defaultIncludeColumns- 要设置的 defaultIncludeColumns
-
getDynamicExcelNames
- 返回:
- dynamicExcelNames
- 从以下版本开始:
- 3.26.0
-
setDynamicExcelNames
- 参数:
dynamicExcelNames- 要设置的 dynamicExcelNames- 从以下版本开始:
- 3.26.0
-
getExportedColumnConfigs
返回需要导出的字段列表
如果字段输出白名单(includeColumns)不为空则返回此名单中的字段配置对象 如果字段输出黑名单excludeColumns不为空则返回不在此名单中的所有字段配置对象 否则返回所有字段; -
getColumnConfigs
返回所有字段配置对象 -
setColumnConfigs
-
getBeanClass
-
setBeanClass
-
getCustomImporter
-
setCustomImporter
-
setCustomImporter
-
getQueueTimeout
public int getQueueTimeout() -
setQueueTimeout
public void setQueueTimeout(int queueTimeout) -
getTotalRowCount
public long getTotalRowCount() -
setTotalRowCount
public void setTotalRowCount(long totalRowCount) -
addColumns
-
addColumns
-
addNestedColumns
-
addNestedColumns
-
addNestedColumn
-
exists
-
configOrNullOf
根据属性路径名查找对应的属性配置对象,没找到返回null- 参数:
nestedName-
-
configByExcelName
根据EXCEL输出字段名名查找对应的属性配置对象,没找到返回null,如果有多个匹配返回第一个- 参数:
excelName- 为null或空返回null- 从以下版本开始:
- 3.26.0
-
configOf
根据属性路径名查找对应的属性配置对象,没找到返回则创建一个默认对象
查找时如果没有找到完全匹配的值会自动切换节点名为驼峰命名格式或蛇形命名格式尝试- 参数:
nestedName-
-
getRowHeight
public short getRowHeight()根据注解获取最大行高 -
merge
将输入的Excel表配置与当前对象的合并
将other中有定义的Excel Sheet配置字段复制到当前对象的对应字段
将other定义的Excel Column配置对象(PropertyConfig)合并到当前的Column配置对象中,如果存在相同的对象,则以other的为准,
如果other.beanClass不为null则复制到当前对象的同名字段- 参数:
other-- 返回:
- 当前对象
- 另请参阅:
-
getAvailableColumns
返回所有可输出字段及字段显示名称 -
getImportColumnConfigs
返回需要导出的字段列表
如果字段输出黑名单excludeColumns不为空则返回不在此名单中的所有字段配置对象 否则返回所有字段;- 从以下版本开始:
- 3.29.4
-
getExcelConfigs
返回所有EXCEL字段名称-PropertyConfig映射- 从以下版本开始:
- 3.29.0
-
getDefaultExportColumns
根据defaultIncludeColumns过滤返回默认输出的字段名和Excel导出时的列名 -
getDefaultExportColumnNames
根据defaultIncludeColumns过滤返回默认输出的字段名 -
setIncludeColumnsOrDefault
指定要输出的字段(白名单),如果输入参数为null或空,则使用getDefaultExportColumnNames()的返回值- 参数:
includeColumns-- 返回:
- 当前对象
- 另请参阅:
-
getIncludeColumnsOrDefault
-
mayBeJavaBean
-