[]
IStyle objects in a specified workbook or the active workbook. This collection stores the workbook's built-in and custom named styles and provides access to them by name or index. Obtain this collection through Workbook.getStyles().
IStyleCollection styles = workbook.getStyles();
IStyle normalStyle = styles.get("Normal");
IStyle customStyle = styles.add("MyStyle");
worksheet.getRange("A1").setStyle(customStyle);
booleanIStyleCollection.get(int index) IStyle object at the specified index from this collection.IStyle object with the specified name from this collection.intgetCount()IStyle objects in the collection.forEach, iterator, spliteratorIStyle objects in the collection.This count includes the named styles available in the workbook, such as built-in styles and any custom styles added to the collection.
IStyleCollection styles = workbook.getStyles();
styles.add("DataStyle");
int count = styles.getCount();
IStyle object with the specified name from this collection.Use this method to retrieve a workbook style by its name from the current IStyleCollection.
IStyleCollection styles = workbook.getStyles();
styles.add("DataStyle");
IStyle style = styles.get("DataStyle");
worksheet.getRange("A1").setStyle(style);
name - Specifies the name of an element in the collection.IStyle object with the specified name.IStyle object at the specified index from this collection.Use this method to retrieve a built-in or custom named style from the workbook style collection by index.
IStyleCollection styles = workbook.getStyles();
IStyle style = styles.get(0);
worksheet.getRange("A1").setStyle(style);
index - Specifies the index of an element in the collection. Valid values are from 0 to getCount() - 1.IStyle object at the specified index.IllegalArgumentException - if index is less than 0 or greater than or equal to getCount().IStyleCollection. Use this method to check whether a built-in or custom named style is available in the workbook style collection returned by Workbook.getStyles().
IStyleCollection styles = workbook.getStyles();
styles.add("DataStyle");
boolean containsStyle = styles.contains("DataStyle");
name - The style name to search for.true if the collection contains a style with the specified name; otherwise, false.IStyle and adds it to the list of styles that are available for the current Workbook. This method is functionally equivalent to add(String,IRange) with baseOn = null.
IStyleCollection styles = workbook.getStyles();
IStyle style = styles.add("DataStyle");
style.getFont().setBold(true);
worksheet.getRange("A1").setStyle(style);
IStyle and adds it to the list of styles that are available for the current Workbook. The new style is based on the style of the specified range. Specify null or use add(String) to base the new style on the Normal style.
IRange cell = worksheet.getRange("A1");
cell.getFont().setBold(true);
IStyle style = workbook.getStyles().add("HeaderStyle", cell);
worksheet.getRange("B1").setStyle(style);
IStyle and adds it to the list of styles that are available for the current Workbook. The new style is created by using an existing IStyle as its basis.
IStyle baseStyle = workbook.getStyles().get("Good");
IStyle style = workbook.getStyles().add("MyGood", baseStyle);
style.getFont().setItalic(true);
worksheet.getRange("A1").setStyle(style);