类 AbstractStyleRender
java.lang.Object
cn.toutatis.xvoid.axolotl.excel.writer.style.AbstractStyleRender
- 所有已实现的接口:
ExcelStyleRender
- 直接已知子类:
AxolotlAdministrationRedTheme,AxolotlClassicalTheme,AxolotlHazeBlueTheme,AxolotlIndustrialOrangeTheme,SimpleBlackTheme
样式渲染器抽象类
继承此抽象类可以获取环境变量实现自定义样式渲染
- 作者:
- Toutatis_Gc
-
嵌套类概要
嵌套类修饰符和类型类说明protected static class属性信息 用于渲染列的数据和合计class表头递归信息 -
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidcalculateColumns(AbstractStyleRender.FieldInfo fieldInfo) 计算列合计voidcheckedAndUseCustomTheme(String themeFont, AxolotlColor themeColor) 检查并使用自定义字体 如果自定义字体不为空,则使用自定义字体,否则使用默认主题字体org.apache.poi.ss.usermodel.CellStylecreateBlackMainTextCellStyle(org.apache.poi.ss.usermodel.BorderStyle borderStyle, org.apache.poi.ss.usermodel.IndexedColors borderColor, AxolotlColor cellColor) org.apache.poi.ss.usermodel.CellStylecreateBlackMainTextCellStyle(org.apache.poi.ss.usermodel.IndexedColors borderColor, AxolotlColor cellColor) org.apache.poi.ss.usermodel.Fontorg.apache.poi.ss.usermodel.FontcreateFont(String fontName, short fontSize, boolean isBold, AxolotlColor color) 创建字体org.apache.poi.ss.usermodel.FontcreateFont(String fontName, short fontSize, boolean isBold, org.apache.poi.ss.usermodel.IndexedColors color) 创建字体org.apache.poi.ss.usermodel.FontcreateMainTextFont(short fontSize, AxolotlColor color) org.apache.poi.ss.usermodel.FontcreateMainTextFont(short fontSize, org.apache.poi.ss.usermodel.IndexedColors color) org.apache.poi.ss.usermodel.FontcreateMainTextFont(AxolotlColor color) org.apache.poi.ss.usermodel.FontcreateMainTextFont(org.apache.poi.ss.usermodel.IndexedColors color) org.apache.poi.ss.usermodel.Fontorg.apache.poi.ss.usermodel.CellStylecreateStyle(org.apache.poi.ss.usermodel.BorderStyle borderStyle, org.apache.poi.ss.usermodel.IndexedColors borderColor, AxolotlColor cellColor, String fontName, short fontSize, boolean isBold, Object fontColor) org.apache.poi.ss.usermodel.CellStylecreateStyle(org.apache.poi.ss.usermodel.BorderStyle borderStyle, org.apache.poi.ss.usermodel.IndexedColors borderColor, AxolotlColor cellColor, org.apache.poi.ss.usermodel.Font font) createTitleRow(org.apache.poi.xssf.streaming.SXSSFSheet sheet) Part.1 表头 Step.1 创建标题行org.apache.poi.ss.usermodel.FontdefaultRenderHeaders(org.apache.poi.xssf.streaming.SXSSFSheet sheet, org.apache.poi.ss.usermodel.CellStyle headerDefaultCellStyle) Part.1 表头 Step.2 递归表头voiddefaultRenderNextData(org.apache.poi.xssf.streaming.SXSSFSheet sheet, Object data, org.apache.poi.ss.usermodel.CellStyle rowStyle) 默认行为渲染数据voidfillWhiteCell(org.apache.poi.ss.usermodel.Sheet sheet, String fontName) 填充空白单元格finish(org.apache.poi.xssf.streaming.SXSSFSheet sheet) 在渲染完成后,调用该方法。org.apache.poi.ss.usermodel.CellStylegetCellStyle(Header header, org.apache.poi.ss.usermodel.CellStyle usedCellStyle) Part.1 表头 辅助方法 获取表头Header样式init(org.apache.poi.xssf.streaming.SXSSFSheet sheet) 初始化。boolean是否是第一批次数据voidmergeTitleRegion(org.apache.poi.xssf.streaming.SXSSFSheet sheet, int titleColumnCount, org.apache.poi.ss.usermodel.CellStyle titleStyle) Part.1 表头 Step.3 合并标题栏单元格并赋予样式voidrenderColumn(AbstractStyleRender.FieldInfo fieldInfo, org.apache.poi.ss.usermodel.Cell cell) 渲染列数据voidsetGlobalFontName(String globalFontName) 从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 cn.toutatis.xvoid.axolotl.excel.writer.style.ExcelStyleRender
renderData, renderHeader
-
字段详细资料
-
writeConfig
写入配置 -
context
写入上下文 -
TOTAL_HEADER_COUNT_KEY
- 另请参阅:
-
-
构造器详细资料
-
AbstractStyleRender
public AbstractStyleRender(org.slf4j.Logger LOGGER)
-
-
方法详细资料
-
globalFontName
-
setGlobalFontName
-
isFirstBatch
public boolean isFirstBatch()是否是第一批次数据- 返回:
- true/false
-
checkedAndUseCustomTheme
检查并使用自定义字体 如果自定义字体不为空,则使用自定义字体,否则使用默认主题字体- 参数:
themeFont- 主题字体
-
init
从接口复制的说明:ExcelStyleRender初始化。 多次写入时,该方法只会被调用一次。 可以用于创建全局样式等。- 指定者:
init在接口中ExcelStyleRender- 参数:
sheet-SXSSFSheet表示工作表对象,用于设置表头样式。
-
fillWhiteCell
填充空白单元格- 参数:
sheet- 工作表fontName- 字体名称
-
createTitleRow
Part.1 表头 Step.1 创建标题行- 参数:
sheet- 工作表- 返回:
- 渲染结果
-
mergeTitleRegion
public void mergeTitleRegion(org.apache.poi.xssf.streaming.SXSSFSheet sheet, int titleColumnCount, org.apache.poi.ss.usermodel.CellStyle titleStyle) Part.1 表头 Step.3 合并标题栏单元格并赋予样式- 参数:
sheet- 工作表
-
defaultRenderHeaders
public AxolotlWriteResult defaultRenderHeaders(org.apache.poi.xssf.streaming.SXSSFSheet sheet, org.apache.poi.ss.usermodel.CellStyle headerDefaultCellStyle) Part.1 表头 Step.2 递归表头- 参数:
sheet- 工作表headerDefaultCellStyle- 表头默认样式
-
getCellStyle
public org.apache.poi.ss.usermodel.CellStyle getCellStyle(Header header, org.apache.poi.ss.usermodel.CellStyle usedCellStyle) Part.1 表头 辅助方法 获取表头Header样式- 参数:
header- 表头usedCellStyle- 使用样式- 返回:
- 表头样式
-
defaultRenderNextData
public void defaultRenderNextData(org.apache.poi.xssf.streaming.SXSSFSheet sheet, Object data, org.apache.poi.ss.usermodel.CellStyle rowStyle) 默认行为渲染数据- 参数:
sheet- 工作表
-
renderColumn
public void renderColumn(AbstractStyleRender.FieldInfo fieldInfo, org.apache.poi.ss.usermodel.Cell cell) 渲染列数据- 参数:
fieldInfo- 字段信息cell- 单元格
-
calculateColumns
计算列合计- 参数:
fieldInfo- 字段信息
-
finish
从接口复制的说明:ExcelStyleRender在渲染完成后,调用该方法。 在Close()方法中调用。- 指定者:
finish在接口中ExcelStyleRender
-
createFont
public org.apache.poi.ss.usermodel.Font createFont(String fontName, short fontSize, boolean isBold, org.apache.poi.ss.usermodel.IndexedColors color) 创建字体- 参数:
fontName- 字体名称fontSize- 字体大小isBold- 是否加粗color- 颜色- 返回:
- 字体
-
createFont
public org.apache.poi.ss.usermodel.Font createFont(String fontName, short fontSize, boolean isBold, AxolotlColor color) 创建字体- 参数:
fontName- 字体名称fontSize- 字体大小isBold- 是否加粗color- 颜色- 返回:
- 字体
-
createMainTextFont
-
createMainTextFont
-
createMainTextFont
public org.apache.poi.ss.usermodel.Font createMainTextFont(short fontSize, org.apache.poi.ss.usermodel.IndexedColors color) -
createMainTextFont
public org.apache.poi.ss.usermodel.Font createMainTextFont(org.apache.poi.ss.usermodel.IndexedColors color) -
createBlackMainTextFont
public org.apache.poi.ss.usermodel.Font createBlackMainTextFont() -
createWhiteMainTextFont
public org.apache.poi.ss.usermodel.Font createWhiteMainTextFont() -
createRedMainTextFont
public org.apache.poi.ss.usermodel.Font createRedMainTextFont() -
createBlackMainTextCellStyle
public org.apache.poi.ss.usermodel.CellStyle createBlackMainTextCellStyle(org.apache.poi.ss.usermodel.IndexedColors borderColor, AxolotlColor cellColor) -
createBlackMainTextCellStyle
public org.apache.poi.ss.usermodel.CellStyle createBlackMainTextCellStyle(org.apache.poi.ss.usermodel.BorderStyle borderStyle, org.apache.poi.ss.usermodel.IndexedColors borderColor, AxolotlColor cellColor) -
createStyle
public org.apache.poi.ss.usermodel.CellStyle createStyle(org.apache.poi.ss.usermodel.BorderStyle borderStyle, org.apache.poi.ss.usermodel.IndexedColors borderColor, AxolotlColor cellColor, org.apache.poi.ss.usermodel.Font font) -
createStyle
public org.apache.poi.ss.usermodel.CellStyle createStyle(org.apache.poi.ss.usermodel.BorderStyle borderStyle, org.apache.poi.ss.usermodel.IndexedColors borderColor, AxolotlColor cellColor, String fontName, short fontSize, boolean isBold, Object fontColor)
-