aspose.cells

Class ConditionalFormattingCollection

Encapsulates a collection of FormatCondition objects.

Example:

//Instantiating a Workbook object
var workbook = new aspose.cells.Workbook();
var sheet = workbook.getWorksheets().get(0);
//Get Conditional Formattings
var cformattings = sheet.getConditionalFormattings();
//Adds an empty conditional formatting
var index = cformattings.add();
//Get newly added Conditional formatting
var fcs = cformattings.get(index);
//Sets the conditional format range.
var ca = new aspose.cells.CellArea();
ca.StartRow = 0;
ca.EndRow = 0;
ca.StartColumn = 0;
ca.EndColumn = 0;
fcs.addArea(ca);
ca = new aspose.cells.CellArea();
ca.StartRow = 1;
ca.EndRow = 1;
ca.StartColumn = 1;
ca.EndColumn = 1;
fcs.addArea(ca);
//Add condition.
var conditionIndex = fcs.addCondition(aspose.cells.FormatConditionType.CELL_VALUE, aspose.cells.OperatorType.BETWEEN, "=A2", "100");
//Add condition.
var conditionIndex2 = fcs.addCondition(aspose.cells.FormatConditionType.CELL_VALUE, aspose.cells.OperatorType.BETWEEN, "50", "100");
//Sets the background color.
var fc = fcs.get(conditionIndex);
fc.getStyle().setBackgroundColor(aspose.cells.Color.getRed());
//Saving the Excel file
workbook.save("Book1.xls");

Property Getters/Setters Summary
functiongetCount()
functionget(index)
Gets the FormatConditions element at the specified index.
 
Method Summary
functionadd()
Adds a FormatConditions to the collection.
functionadd(value)
Reserved for internal use.
functionclear()
functioncontains(value)
Reserved for internal use.
functioncopy(cfs)
Copies condtional formattings.
functionget(index)
Reserved for internal use.
functionindexOf(value)
Reserved for internal use.
functioniterator()
functionremoveArea(startRow, startColumn, totalRows, totalColumns)
Remove all conditional formattings in the range.
functionremoveAt(index)
 

    • Property Getters/Setters Detail

      • getCount : Number 

        function getCount()
        
      • get : FormatConditionCollection 

        function get(index)
        
        Gets the FormatConditions element at the specified index.
        Parameters:
        index - The zero based index of the element.
    • Method Detail

      • removeArea

        function removeArea(startRow, startColumn, totalRows, totalColumns)
        Remove all conditional formattings in the range.
        Parameters:
        startRow: Number - The start row of the range.
        startColumn: Number - The start column of the range.
        totalRows: Number - The number of rows of the range.
        totalColumns: Number - The number of columns of the range.
      • copy

        function copy(cfs)
        Copies condtional formattings.
        Parameters:
        cfs: ConditionalFormattingCollection - The condtional formattings
      • add

        function add()
        Adds a FormatConditions to the collection.
        Returns:
        FormatConditions object index.
      • clear

        function clear()
      • removeAt

        function removeAt(index)
      • iterator

        function iterator()
      • get

        function get(index)
        Reserved for internal use.
      • contains

        function contains(value)
        Reserved for internal use.
      • add

        function add(value)
        Reserved for internal use.
      • indexOf

        function indexOf(value)
        Reserved for internal use.