Class HSSFColorConverter

java.lang.Object
com.vaadin.flow.component.spreadsheet.HSSFColorConverter
All Implemented Interfaces:
ColorConverter, Serializable

public class HSSFColorConverter extends Object implements ColorConverter
Color converter implementation for the older Excel file type (.xls or HSSF in POI terms).
Since:
1.0
Author:
Vaadin Ltd.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    HSSFColorConverter(org.apache.poi.hssf.usermodel.HSSFWorkbook wb)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    colorStyles(org.apache.poi.ss.usermodel.CellStyle cellStyle, StringBuilder sb)
    Creates the appropriate CSS text and background style for the given cell style.
    void
    defaultColorStyles(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 right, String attribute, org.apache.poi.ss.usermodel.BorderFormatting borderFormatting)
    Returns CSS border definitions for the given conditional formatting rule
    getBorderColorCSS(org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder.BorderSide borderSide, String attr, org.apache.poi.ss.usermodel.CellStyle cellStyle)
    Returns CSS border definitions for the given cell style
    getFontColorCSS(org.apache.poi.ss.usermodel.ConditionalFormattingRule rule)
    Create a CSS color string for the font in the given rule.
    boolean
    hasBackgroundColor(org.apache.poi.ss.usermodel.CellStyle cellStyle)
    Returns true if the given cell style has a background color.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HSSFColorConverter

      public HSSFColorConverter(org.apache.poi.hssf.usermodel.HSSFWorkbook wb)
  • Method Details

    • getBorderColorCSS

      public String getBorderColorCSS(org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder.BorderSide borderSide, String attr, org.apache.poi.ss.usermodel.CellStyle cellStyle)
      Description copied from interface: ColorConverter
      Returns CSS border definitions for the given cell style
      Specified by:
      getBorderColorCSS in interface ColorConverter
      Parameters:
      borderSide - Which side the border should go
      attr - What type of border style we want (solid, dashed..)
      cellStyle - Style for the cell
    • colorStyles

      public void colorStyles(org.apache.poi.ss.usermodel.CellStyle cellStyle, StringBuilder sb)
      Description copied from interface: ColorConverter
      Creates the appropriate CSS text and background style for the given cell style.
      Specified by:
      colorStyles in interface ColorConverter
      Parameters:
      cellStyle - The cell style.
      sb - to write the styles in
    • defaultColorStyles

      public void defaultColorStyles(org.apache.poi.ss.usermodel.CellStyle cellStyle, StringBuilder sb)
      Description copied from interface: ColorConverter
      Writes the default background and foreground colors as CSS styles from the given cell style to the given string buffer.
      Specified by:
      defaultColorStyles in interface ColorConverter
      Parameters:
      cellStyle - The cell style
      sb - to write the styles in
    • hasBackgroundColor

      public boolean hasBackgroundColor(org.apache.poi.ss.usermodel.CellStyle cellStyle)
      Description copied from interface: ColorConverter
      Returns true if the given cell style has a background color.
      Specified by:
      hasBackgroundColor in interface ColorConverter
      Returns:
      Whether the given cell style has a defined background color or not.
    • getBackgroundColorCSS

      public String getBackgroundColorCSS(org.apache.poi.ss.usermodel.ConditionalFormattingRule rule)
      Description copied from interface: ColorConverter
      Create a CSS color string for the background in the given rule.
      Specified by:
      getBackgroundColorCSS in interface ColorConverter
      Parameters:
      rule - Formatting rule
      Returns:
      valid color string with semicolon or null if no color matches.
    • getFontColorCSS

      public String getFontColorCSS(org.apache.poi.ss.usermodel.ConditionalFormattingRule rule)
      Description copied from interface: ColorConverter
      Create a CSS color string for the font in the given rule.
      Specified by:
      getFontColorCSS in interface ColorConverter
      Parameters:
      rule - Formatting rule
      Returns:
      valid color string with semicolon or null if no color matches.
    • getBorderColorCSS

      public String getBorderColorCSS(org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder.BorderSide right, String attribute, org.apache.poi.ss.usermodel.BorderFormatting borderFormatting)
      Description copied from interface: ColorConverter
      Returns CSS border definitions for the given conditional formatting rule
      Specified by:
      getBorderColorCSS in interface ColorConverter
      Parameters:
      right - Which side the border should go
      attribute - What type of border style we want (solid, dashed..)
      borderFormatting - the active formatting