Aspose::Cells::IConditionalFormattingCollection Class Referenceabstract

Encapsulates a collection of FormatCondition objects. More...

Inherits CollectionBase.

Public Member Functions

virtual void RemoveArea (Aspose::Cells::Systems::Int32 startRow, Aspose::Cells::Systems::Int32 startColumn, Aspose::Cells::Systems::Int32 totalRows, Aspose::Cells::Systems::Int32 totalColumns)=0
 Remove all conditional formatting in the range. More...
 
virtual void Copy (intrusive_ptr< Aspose::Cells::IConditionalFormattingCollection > cfs)=0
 Copies conditional formatting. More...
 
virtual intrusive_ptr< Aspose::Cells::IFormatConditionCollectionGetObjectByIndex (Aspose::Cells::Systems::Int32 index)=0
 Gets the FormatConditions element at the specified index. More...
 
virtual Aspose::Cells::Systems::Int32 Add ()=0
 Adds a FormatConditions to the collection. More...
 

Detailed Description

Encapsulates a collection of FormatCondition objects.

[C++]
//Instantiating a Workbook object
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook();
intrusive_ptr<IWorksheet> sheet = workbook->GetIWorksheets()->GetObjectByIndex(0);
<br><br><br> //Get Conditional Formattings
intrusive_ptr<IConditionalFormattingCollection> cformattings = sheet->GetIConditionalFormattings();
<br><br><br> //Adds an empty conditional formatting
int index = cformattings->Add();
<br><br><br> //Get newly added Conditional formatting
intrusive_ptr<IFormatConditionCollection> fcs = cformattings->GetObjectByIndex(index);
<br><br><br> //Sets the conditional format range.
intrusive_ptr<ICellArea> ca = Factory::CreateICellArea();
<br><br><br> ca->SetstartRow(0);
<br><br><br> ca->SetendRow(0);
<br><br><br> ca->SetstartColumn(0);
<br><br><br> ca->SetendColumn(0);
<br><br><br> fcs->AddArea(ca);
<br><br><br> ca = Factory::CreateICellArea();
<br><br><br> ca->SetstartRow(1);
ca->SetendRow(1);
ca->SetstartColumn(1);
ca->SetendColumn(1);
fcs->AddArea(ca); //Add condition. int conditionIndex = fcs->AddCondition(FormatConditionType_CellValue, OperatorType::OperatorType_Between, new String("=A2"), new String("100"));
<br> //Add condition.
int conditionIndex2 = fcs->AddCondition(FormatConditionType_CellValue, OperatorType::OperatorType_Between, new String("50"), new String("100"));
<br> //Sets the background color.
intrusive_ptr<IFormatCondition> fc = fcs->GetObjectByIndex(conditionIndex);
<br> fc->GetIStyle()->SetBackgroundColor(Color::GetRed());
<br> //Saving the Excel file
workbook->Save(new String("C:\\output.xls"));

Member Function Documentation

◆ Add()

virtual Aspose::Cells::Systems::Int32 Aspose::Cells::IConditionalFormattingCollection::Add ( )
pure virtual

Adds a FormatConditions to the collection.

Returns
FormatConditions object index.

◆ Copy()

virtual void Aspose::Cells::IConditionalFormattingCollection::Copy ( intrusive_ptr< Aspose::Cells::IConditionalFormattingCollection cfs)
pure virtual

Copies conditional formatting.

Parameters
cfsThe conditional formatting

◆ GetObjectByIndex()

virtual intrusive_ptr<Aspose::Cells::IFormatConditionCollection> Aspose::Cells::IConditionalFormattingCollection::GetObjectByIndex ( Aspose::Cells::Systems::Int32  index)
pure virtual

Gets the FormatConditions element at the specified index.

Parameters
indexThe zero based index of the element.

◆ RemoveArea()

virtual void Aspose::Cells::IConditionalFormattingCollection::RemoveArea ( Aspose::Cells::Systems::Int32  startRow,
Aspose::Cells::Systems::Int32  startColumn,
Aspose::Cells::Systems::Int32  totalRows,
Aspose::Cells::Systems::Int32  totalColumns 
)
pure virtual

Remove all conditional formatting in the range.

Parameters
startRowThe start row of the range.
startColumnThe start column of the range.
totalRowsThe number of rows of the range.
totalColumnsThe number of columns of the range.