Home  Products  Purchase  Downloads  Demos  Forums  Blogs  Ticket  Wiki  API  Corporate


com.aspose.cells
Class FormatConditions

java.lang.Object
  extended by com.aspose.cells.FormatConditions

public class FormatConditions
extends java.lang.Object

Represents conditional formatting. The FormatConditions can contain up to three conditional formats.


Method Summary
 int addArea(CellArea cellArea)
          Adds a conditional formatted cell range.
 int[] addFormatCondition(CellArea cellArea, int type, int operator, java.lang.String formula1, java.lang.String formula2)
          Adds a formatting condition and effected cell rang to the FormatConditions.
 int addFormatCondition(int type)
          Add a format condition.
 int addFormatCondition(int type, int operator, java.lang.String formula1, java.lang.String formula2)
          Adds a formatting condition.
 void deleteFormatCondition(int index)
          Removes the formatting condition by index.
 CellArea getCellArea(int index)
          Gets the conditional formatted cell range by index.
 FormatCondition getFormatCondition(int index)
          Gets the formatting conidition by index.
 void removeAffectedRange(CellArea cellArea)
          Removes given range from all ranges of this ConditionalFormatting if given range exists partly or completely.
 int sizeOfCellAreaList()
          Gets size of conditionally formatted ranges.
 int sizeOfConditionList()
          Gets size of formatting conditions.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addFormatCondition

public int[] addFormatCondition(CellArea cellArea,
                                int type,
                                int operator,
                                java.lang.String formula1,
                                java.lang.String formula2)
Adds a formatting condition and effected cell rang to the FormatConditions. The FormatConditions can contain up to three conditional formats. References to the other sheets are not allowed in the formulas of conditional formatting. For formulas, if Cell reference in formula is relative, the base Cell is the top-left corner of the first range in the effected ranges list(getCellArea(0)).

Parameters:
cellArea - conditional formatted cell range.
type - type of conditional formatting.It could be one of the members of FormatConditionType.
operator - comparison operator.It could be one of the members of OperatorType.
formula1 - the value or expression associated with conditional formatting.
formula2 - the value or expression associated with conditional formatting.
Returns:
[0]:formatting condition object index;[1] effected cell rang index.
Throws:
CellsException - if conditional formattings have bean removed from the sheet.
java.lang.IllegalArgumentException - if operator type is invalid.
java.lang.IllegalArgumentException - if type of conditional formatting is invalid.
java.lang.IllegalArgumentException - if number of formatting conditions is greater than 3.
See Also:
FormatCondition.setType(int), OperatorType

addFormatCondition

public int addFormatCondition(int type)
Add a format condition.

Parameters:
type - type of conditional formatting.It could be one of the members of FormatConditionType.
Returns:
formatting condition object index.

addArea

public int addArea(CellArea cellArea)
Adds a conditional formatted cell range.

Parameters:
cellArea - conditional formatted cell range. Note: modifying this CellArea object directly to change its range later after this call maybe gets no effect for the FormatConditions when this CellArea overlaps other existed areas of ConditionalFormattings.
Returns:
the conditional formatted index.
Throws:
CellsException - if conditional formattings have bean removed from the sheet.

addFormatCondition

public int addFormatCondition(int type,
                              int operator,
                              java.lang.String formula1,
                              java.lang.String formula2)
Adds a formatting condition.

Parameters:
type - type of conditinal formatting.
operator - comparison operator.
formula1 - the value or expression associated with conditinal formatting.
formula2 - the value or expression associated with conditinal formatting.
Returns:
the formatting condition index.
Throws:
CellsException - if conditional formattings have bean removed from the sheet.
java.lang.IllegalArgumentException - if number of formatting conditions is greater than 3.
See Also:
addFormatCondition(CellArea, int, int, String, String)

getFormatCondition

public FormatCondition getFormatCondition(int index)
Gets the formatting conidition by index.

Parameters:
index - the index of the formatting conidition to return.
Returns:
the formatting conidition.
Throws:
CellsException - if conditional formattings have bean removed from the sheet.
java.lang.IllegalArgumentException - if the index is out of range.

getCellArea

public CellArea getCellArea(int index)
Gets the conditional formatted cell range by index. User should not directly change the range of returned CellArea object. Doing so maybe gets no effect for the FormatConditions when this CellArea expands to overlaps other existed areas of ConditionalFormattings.

Parameters:
index - the index of the conditional formatted cell range to return.
Returns:
the conditional formatted cell range.
Throws:
CellsException - if conditional formattings have bean removed from the sheet.
java.lang.IllegalArgumentException - if the index is out of range.

removeAffectedRange

public void removeAffectedRange(CellArea cellArea)
Removes given range from all ranges of this ConditionalFormatting if given range exists partly or completely.

Parameters:
cellArea - the range to remove from ranges this ConditionalFormatting affects.

sizeOfCellAreaList

public int sizeOfCellAreaList()
Gets size of conditionally formatted ranges.

Returns:
size of conditionally formatted ranges.

sizeOfConditionList

public int sizeOfConditionList()
Gets size of formatting conditions.

Returns:
size of formatting conditions.

deleteFormatCondition

public void deleteFormatCondition(int index)
Removes the formatting condition by index.

Parameters:
index - the index of the formatting condition to removed.
Throws:
CellsException - if conditional formattings have bean removed from the sheet.
java.lang.IllegalArgumentException - if the index is out of range.