Interface ColorConverter

  • All Superinterfaces:
    Serializable
    All Known Implementing Classes:
    HSSFColorConverter, XSSFColorConverter

    public interface ColorConverter
    extends Serializable
    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

      All Methods Instance Methods Abstract Methods 
      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.
      String getBackgroundColorCSS​(org.apache.poi.ss.usermodel.ConditionalFormattingRule rule)
      Create a CSS color string for the background in the given rule.
      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
      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
      String 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 cs)
      Returns true if the given cell style has a background color.
    • Method Detail

      • colorStyles

        void colorStyles​(org.apache.poi.ss.usermodel.CellStyle cellStyle,
                         StringBuilder sb)
        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 go
        attribute - 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 go
        attribute - What type of border style we want (solid, dashed..)
        format - the active formatting
      • defaultColorStyles

        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.
        Parameters:
        cellStyle - The cell style
        sb - 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

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

        String getFontColorCSS​(org.apache.poi.ss.usermodel.ConditionalFormattingRule rule)
        Create a CSS color string for the font in the given rule.
        Parameters:
        rule - Formatting rule
        Returns:
        valid color string with semicolon or null if no color matches.