asposecells.api
Class ConditionalFormattingCollection

Encapsulates a collection of FormatCondition objects.

Example:

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

Property Getters/Setters Summary
methodgetCount()
          
methodget(index)
           Gets the FormatConditions element at the specified index.
 
Method Summary
methodadd()
           Adds a FormatConditions to the collection.
methodadd(value)→ inherited from CollectionBase
          Reserved for internal use.
methodclear()→ inherited from CollectionBase
          
methodcontains(value)→ inherited from CollectionBase
          Reserved for internal use.
methodcopy(cfs)
           Copies condtional formattings.
methodget(index)→ inherited from CollectionBase
          Reserved for internal use.
methodindexOf(value)→ inherited from CollectionBase
          Reserved for internal use.
methoditerator()→ inherited from CollectionBase
          
methodremoveArea(startRow, startColumn, totalRows, totalColumns)
           Remove all conditional formattings in the range.
methodremoveAt(index)→ inherited from CollectionBase
          
 

Property Getters/Setters Detail

getCount : int 

int getCount()

get : FormatConditionCollection 

FormatConditionCollection get(index)
Gets the FormatConditions element at the specified index.
Parameters:
index - The zero based index of the element.

Method Detail

removeArea

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

copy

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

add

int add()
Adds a FormatConditions to the collection.
Returns:
FormatConditions object index.

clear

 clear()

removeAt

 removeAt(index)

iterator

Iterator iterator()

get

Object get(index)
Reserved for internal use.

contains

boolean contains(value)
Reserved for internal use.

add

int add(value)
Reserved for internal use.

indexOf

int indexOf(value)
Reserved for internal use.

See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cellss Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.