Interface ColorConverter
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
HSSFColorConverter,XSSFColorConverter
Interface for providing different color-related operations on the
Spreadsheet.
This interface has been created because the POI implementations differ quite a lot.
-
Method Summary
Modifier and TypeMethodDescriptionvoidcolorStyles(org.apache.poi.ss.usermodel.CellStyle cellStyle, StringBuilder sb) Creates the appropriate CSS text and background style for the given cell style.voiddefaultColorStyles(org.apache.poi.ss.usermodel.CellStyle cellStyle, StringBuilder sb) Writes the default background and foreground colors as CSS styles from the given cell style to the given string buffer.getBackgroundColorCSS(org.apache.poi.ss.usermodel.ConditionalFormattingRule rule) Create a CSS color string for the background in the given rule.getBorderColorCSS(org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder.BorderSide borderSide, String attribute, org.apache.poi.ss.usermodel.BorderFormatting format) Returns CSS border definitions for the given conditional formatting rulegetBorderColorCSS(org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder.BorderSide borderSide, String attribute, org.apache.poi.ss.usermodel.CellStyle cellStyle) Returns CSS border definitions for the given cell stylegetFontColorCSS(org.apache.poi.ss.usermodel.ConditionalFormattingRule rule) Create a CSS color string for the font in the given rule.booleanhasBackgroundColor(org.apache.poi.ss.usermodel.CellStyle cs) Returns true if the given cell style has a background color.
-
Method Details
-
colorStyles
Creates the appropriate CSS text and background style for the given cell style.- Parameters:
cellStyle- The cell style.sb- to write the styles in
-
getBorderColorCSS
String getBorderColorCSS(org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder.BorderSide borderSide, String attribute, org.apache.poi.ss.usermodel.CellStyle cellStyle) Returns CSS border definitions for the given cell style- Parameters:
borderSide- Which side the border should goattribute- What type of border style we want (solid, dashed..)cellStyle- Style for the cell
-
getBorderColorCSS
String getBorderColorCSS(org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder.BorderSide borderSide, String attribute, org.apache.poi.ss.usermodel.BorderFormatting format) Returns CSS border definitions for the given conditional formatting rule- Parameters:
borderSide- Which side the border should goattribute- What type of border style we want (solid, dashed..)format- the active formatting
-
defaultColorStyles
Writes the default background and foreground colors as CSS styles from the given cell style to the given string buffer.- Parameters:
cellStyle- The cell stylesb- to write the styles in
-
hasBackgroundColor
boolean hasBackgroundColor(org.apache.poi.ss.usermodel.CellStyle cs) Returns true if the given cell style has a background color.- Parameters:
cs-- Returns:
- Whether the given cell style has a defined background color or not.
-
getBackgroundColorCSS
Create a CSS color string for the background in the given rule.- Parameters:
rule- Formatting rule- Returns:
- valid color string with semicolon or
nullif no color matches.
-
getFontColorCSS
Create a CSS color string for the font in the given rule.- Parameters:
rule- Formatting rule- Returns:
- valid color string with semicolon or
nullif no color matches.
-