public class ConditionalFormattingIconCollection extends CollectionBase
ConditionalFormattingIcon objects.
Example
//Instantiating a Workbook object
Workbook workbook = new Workbook();
Worksheet sheet = workbook.getWorksheets().get(0);
//Get Conditional Formatting
ConditionalFormattingCollection cformattings = sheet.getConditionalFormattings();
//Adds an empty conditional formatting
int index = cformattings.add();
//Get newly added Conditional formatting
FormatConditionCollection fcs = cformattings.get(index);
//Sets the conditional format range.
CellArea ca = new CellArea();
ca.StartRow = 0;
ca.EndRow = 0;
ca.StartColumn = 0;
ca.EndColumn = 0;
fcs.addArea(ca);
ca = new CellArea();
ca.StartRow = 1;
ca.EndRow = 1;
ca.StartColumn = 1;
ca.EndColumn = 1;
fcs.addArea(ca);
//Sets condition
int idx = fcs.addCondition(FormatConditionType.ICON_SET);
FormatCondition cond = fcs.get(idx);
//Sets condition's type
cond.getIconSet().setType(IconSetType.ARROWS_GRAY_3);
//Add custom iconset condition.
ConditionalFormattingIcon cfIcon = cond.getIconSet().getCfIcons().get(0);
cfIcon.setType(IconSetType.ARROWS_3);
cfIcon.setIndex(0);
ConditionalFormattingIcon cfIcon1 = cond.getIconSet().getCfIcons().get(1);
cfIcon1.setType(IconSetType.ARROWS_GRAY_3);
cfIcon1.setIndex(1);
ConditionalFormattingIcon cfIcon2 = cond.getIconSet().getCfIcons().get(2);
cfIcon2.setType(IconSetType.BOXES_5);
cfIcon2.setIndex(2);
//Saving the Excel file
workbook.save("output.xls");
| Modifier and Type | Method and Description |
|---|---|
int |
add(ConditionalFormattingIcon cficon)
Adds
ConditionalFormattingIcon object. |
int |
add(int type,
int index)
Adds
ConditionalFormattingIcon object. |
ConditionalFormattingIcon |
get(int index)
Gets the ConditionalFormattingIcon element at the specified index.
|
public ConditionalFormattingIcon get(int index)
get in class CollectionBaseindex - The zero based index of the element.public int add(int type,
int index)
ConditionalFormattingIcon object.type - IconSetType. The value type.index - The Index.public int add(ConditionalFormattingIcon cficon)
ConditionalFormattingIcon object.cficon - Returns the index of new object in the list.See Also:
Aspose.Cells Documentation - the home page for the Aspose.Cells Product Documentation.
Aspose.Cells Support Forum - our preferred method of support.
We guarantee a prompt response to any inquiry!
© Aspose Pty Ltd 2003-2025. All Rights Reserved.