Class StyleManager


  • public class StyleManager
    extends Object
    Class representing a style manager to maintain all styles and its components of a workbook
    Author:
    Raphael Stockeli
    • Constructor Detail

      • StyleManager

        public StyleManager()
        Default constructor
    • Method Detail

      • getBorderByHash

        public Border getBorderByHash​(int hash)
        Gets a border by its hash
        Parameters:
        hash - Hash of the border
        Returns:
        Determined border
        Throws:
        StyleException - Throws a StyleException if the border was not found in the style manager
      • getBorders

        public Border[] getBorders()
        Gets all borders of the style manager
        Returns:
        Array of borders
      • getBorderStyleNumber

        public int getBorderStyleNumber()
        Gets the number of borders in the style manager
        Returns:
        Number of stored borders
      • getCellXfByHash

        public CellXf getCellXfByHash​(int hash)
        Gets a cellXf by its hash
        Parameters:
        hash - Hash of the cellXf
        Returns:
        Determined cellXf
        Throws:
        StyleException - Throws a StyleException if the cellXf was not found in the style manager
      • getCellXfs

        public CellXf[] getCellXfs()
        Gets all cellXfs of the style manager
        Returns:
        Array of cellXfs
      • getCellXfStyleNumber

        public int getCellXfStyleNumber()
        Gets the number of cellXfs in the style manager
        Returns:
        Number of stored cellXfs
      • getFillByHash

        public Fill getFillByHash​(int hash)
        Gets a font by its hash
        Parameters:
        hash - Hash of the font
        Returns:
        Determined font
        Throws:
        StyleException - Throws a StyleException if the font was not found in the style manager
      • getFills

        public Fill[] getFills()
        Gets all fills of the style manager
        Returns:
        Array of fills
      • getFillStyleNumber

        public int getFillStyleNumber()
        Gets the number of fills in the style manager
        Returns:
        Number of stored fills
      • getFontByHash

        public Font getFontByHash​(int hash)
        Gets a font by its hash
        Parameters:
        hash - Hash of the font
        Returns:
        Determined font
        Throws:
        StyleException - Throws a StyleException if the font was not found in the style manager
      • getFonts

        public Font[] getFonts()
        Gets all fonts of the style manager
        Returns:
        Array of fonts
      • getFontStyleNumber

        public int getFontStyleNumber()
        Gets the number of fonts in the style manager
        Returns:
        Number of stored fonts
      • getNumberFormatByHash

        public NumberFormat getNumberFormatByHash​(int hash)
        Gets a number format by its hash
        Parameters:
        hash - Hash of the number format
        Returns:
        Determined number format
        Throws:
        StyleException - Throws a StyleException if the number format was not found in the style manager
      • getNumberFormats

        public NumberFormat[] getNumberFormats()
        Gets all number formats of the style manager
        Returns:
        Array of number formats
      • getNumberFormatStyleNumber

        public int getNumberFormatStyleNumber()
        Gets the number of number formats in the style manager
        Returns:
        Number of stored number formats
      • getStyleByName

        public Style getStyleByName​(String name)
        Gets a style by its name
        Parameters:
        name - Name of the style
        Returns:
        Determined style
        Throws:
        StyleException - Throws a StyleException if the style was not found in the style manager
      • getStyleByHash

        public Style getStyleByHash​(int hash)
        Gets a style by its hash
        Parameters:
        hash - Hash of the style
        Returns:
        Determined style
        Throws:
        StyleException - Throws a StyleException if the style was not found in the style manager
      • getStyles

        public Style[] getStyles()
        Gets all styles of the style manager
        Returns:
        Array of styles
      • getStyleNumber

        public int getStyleNumber()
        Gets the number of styles in the style manager
        Returns:
        Number of stored styles
      • addStyle

        public Style addStyle​(Style style)
        Adds a style component to the manager
        Parameters:
        style - Style to add
        Returns:
        Added or determined style in the manager
      • removeStyle

        public void removeStyle​(String styleName)
        Removes a style and all its components from the style manager
        Parameters:
        styleName - Name of the style to remove
        Throws:
        StyleException - Throws a StyleException if the style was not found in the style manager