com.aspose.cells

Class StyleCollection

  • java.lang.Object
    • com.aspose.cells.StyleCollection
public class StyleCollection 
extends java.lang.Object

Encapsulates a collection of Style objects.
NOTE: This class is now obsolete. Instead, please use Workbook.CreateStyle() to create and manipulate style for workbook instead of StyleCollection.Add() and use Workbook.GetNamedStyle(string) to get named style instead of StyleCollection[string]. This property will be removed 12 months later since February 2015. Aspose apologizes for any inconvenience you may have experienced.

Example:

Workbook workbook = new Workbook();
StyleCollection styles = workbook.getStyles();
int styleIndex = styles.add();
Style style = workbook.getStyles().get(styleIndex);

Property Getters/Setters Summary
intgetCount()
Gets the count of elements in the collection.
Styleget(intindex)
Gets the Style element at the specified index.
Styleget(java.lang.Stringname)
Gets the Style element with the specified name.
 
Method Summary
intadd()
Adds a Style to the collection.
StylecreateBuiltinStyle(inttype)
Creates built-in style by given type.
StylegetThemeStyle(intthemeColorType, doubletint)
Gets the theme style.
 

    • Property Getters/Setters Detail

      • getCount

        public int getCount()
        
        Gets the count of elements in the collection.
      • get

        public Style get(int index)
        
        Gets the Style element at the specified index.
        Parameters:
        index - The zero based index of the element.
        Returns:
        The element at the specified index.

        Example:

        StyleCollection styles = excel.getStyles();
        int styleIndex = styles.add();
        Style style = styles.get(styleIndex);
      • get

        public Style get(java.lang.String name)
        
        Gets the Style element with the specified name.
        Parameters:
        name - Style name
        Returns:
        The element with the specified name.

        Example:

        StyleCollection styles = excel.getStyles();
        int styleIndex = styles.add();
        Style style = styles.get(styleIndex);
        style.setName("MyStyle");
        //.....................
        Style newStyle = styles.get("MyStyle");
    • Method Detail

      • getThemeStyle

        public Style getThemeStyle(int themeColorType, double tint)
        Gets the theme style.
        Parameters:
        themeColorType - A ThemeColorType value. The theme color type.
        tint - The tint value.
        Returns:
      • createBuiltinStyle

        public Style createBuiltinStyle(int type)
        Creates built-in style by given type.
        Parameters:
        type - A BuiltinStyleType value.
        Returns:
        style object
      • add

        public int add()
        Adds a Style to the collection. If using this method to create a new style and the style name is set, a new style will be added to the style dialog of MS Excel. To avoid this, you can leave the style name blank. NOTE: This property is now obsolete. Instead, please use Workbook.CreateStyle() to create and manipulate style for workbook instead. This property will be removed 12 months later since December 2014. Aspose apologizes for any inconvenience you may have experienced.
        Returns:
        Style object index.