All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aspose.cells.ConditionalFormattingCollection.html Maven / Gradle / Ivy






ConditionalFormattingCollection




com.aspose.cells
Class ConditionalFormattingCollection

java.lang.Object
  extended by CollectionBase
      extended by com.aspose.cells.ConditionalFormattingCollection
All Implemented Interfaces:
java.lang.Iterable

public class ConditionalFormattingCollection 
extends CollectionBase

Encapsulates a collection of FormatCondition objects.

Example:

//Instantiating a Workbook object
Workbook workbook = new Workbook();

Worksheet sheet = workbook.getWorksheets().get(0);

//Get Conditional Formattings
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);

//Add condition.
int conditionIndex = fcs.addCondition(FormatConditionType.CELL_VALUE, OperatorType.BETWEEN, "=A2", "100");

//Add condition.
int conditionIndex2 = fcs.addCondition(FormatConditionType.CELL_VALUE, OperatorType.BETWEEN, "50", "100");

//Sets the background color.
FormatCondition fc = fcs.get(conditionIndex);

fc.getStyle().setBackgroundColor(Color.getRed());

//Saving the Excel file
workbook.save("C:\\output.xls");


Property Getters/Setters Summary
intgetCount()→ inherited from com.aspose.cells.CollectionBase
          
FormatConditionCollectionget(int)
           Gets the FormatConditions element at the specified index.
 
Method Summary
intadd()
           Adds a FormatConditions to the collection.
intadd(java.lang.Object value)→ inherited from com.aspose.cells.CollectionBase
          Reserved for internal use.
voidclear()→ inherited from com.aspose.cells.CollectionBase
          
booleancontains(java.lang.Object value)→ inherited from com.aspose.cells.CollectionBase
          Reserved for internal use.
voidcopy(ConditionalFormattingCollection cfs)
           Copies conditional formatting.
intindexOf(java.lang.Object value)→ inherited from com.aspose.cells.CollectionBase
          Reserved for internal use.
java.util.Iteratoriterator()→ inherited from com.aspose.cells.CollectionBase
          
voidremoveArea(int startRow, int startColumn, int totalRows, int totalColumns)
           Remove all conditional formatting in the range.
voidremoveAt(int index)→ inherited from com.aspose.cells.CollectionBase
          
 

Property Getters/Setters Detail

getCount

→ inherited from com.aspose.cells.CollectionBase
public int getCount()

get

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

Method Detail

removeArea

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

copy

public void copy(ConditionalFormattingCollection cfs)
Copies conditional formatting.
Parameters:
cfs - The conditional formatting

add

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

clear

→ inherited from com.aspose.cells.CollectionBase
public void clear()

removeAt

→ inherited from com.aspose.cells.CollectionBase
public void removeAt(int index)

iterator

→ inherited from com.aspose.cells.CollectionBase
public java.util.Iterator iterator()

contains

→ inherited from com.aspose.cells.CollectionBase
public boolean contains(java.lang.Object value)
Reserved for internal use.

add

→ inherited from com.aspose.cells.CollectionBase
public int add(java.lang.Object value)
Reserved for internal use.

indexOf

→ inherited from com.aspose.cells.CollectionBase
public int indexOf(java.lang.Object value)
Reserved for internal use.

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





© 2015 - 2024 Weber Informatics LLC | Privacy Policy