GetByRange(Range: ITabRange): ITabFormatConditions;
Range. Cell range.
The GetByRange method returns style of a selected cell range.
If the Range parameter is set to Null, the GetByRange property returns an empty style.
Executing the example requires a form, a button named Button1 on the form, the LanerBox component and the UiErAnalyzer component named UiErAnalyzer1, that is a data source for LanerBox. The workbook of time series database should be loaded to UiErAnalyzer1.
The example is executed on clicking the button.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Grid: IEaxGrid;
View: ITabView;
Range: ITabRange;
Style: IEaxTableStyle;
RangeFCond: IEaxRangeFormatConditions;
FConditions: ITabFormatConditions;
FormatCond: ITabFormatCondition;
Count, i: Integer;
a: String;
CondType: TabConditionType;
Begin
Grid := UiErAnalyzer1.ErAnalyzer.Grid;
View := Grid.TabSheet.View;
Range := View.Selection.Range;
Style := Grid.Style;
RangeFCond := Style.RangeFormatConditions;
FConditions := RangeFCond.GetByRange(Range);
Count := FConditions.Count;
If Count > 0 Then
For i := 0 To Count - 1 Do
FormatCond := FConditions.Item(i);
Debug.WriteLine("Style ?" + i.ToString);
CondType := FormatCond.Type;
Select Case CondType
Case TabConditionType.Average: a := "Format cells with values higher/lower than average";
Case TabConditionType.CellContent: a := "Format cells with specified values";
Case TabConditionType.Duplicate: a := "Format cells with unique/duplicate values";
Case TabConditionType.Formula: a := "format cells satisfying formula";
Case TabConditionType.MinMax: a := "format cells with greatest/least values";
Case TabConditionType.Values: a := "format cells based on their values";
End Select;
Debug.WriteLine(" type: " + a);
End For;
End If;
RangeFCond.RemoveByRange(Range);
Grid.Refresh;
End Sub Button1OnClick;
After executing the example the console window displays description of the conditional formatting styles applied to the selected range of workbook cells. After that the styles are deleted.
See also: