IEaxRangeCellStyles.Count

Syntax

Count: Integer;

Description

The Count property returns the number of styles in the collection.

Comments

Collection capacity is the number of element a collection can contain. The Count property is the number of variables actually contained in the collection.

Capacity always exceeds or equals to the Count property value. If capacity of the Count property is exceeded when a new style is added to the collection, the capacity automatically increases.

Example

Executing the example requires a form, a button named Button1 on the form, the LanerBox component and the UiErAnalyzer component with the UiErAnalyzer1 identifier, that is a data source for LanerBox. The workbook of time series database should be loaded to UiErAnalyzer1. Add a link to the Drawing system assembly.

The example is executed on clicking the button.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Grid: IEaxGrid;
    Style: IEaxTableStyle;
    CellStyle: ITabCellStyle;
    i, count: Integer;
    a: String;
    RangeStyle: IEaxRangeCellStyle;
    TabCellStyle: ITabCellStyle;
Begin
    Grid := UiErAnalyzer1.ErAnalyzer.Grid;
    Style := Grid.Style;
    CStyles := Style.RangeCellStyles;
    count := CStyles.Count;
    Debug.WriteLine("Number  of styles: " + count.ToString);
    For i := 0 To count - 1 Do
        RangeStyle := CStyles.Item(i);
        TabCellStyle := RangeStyle.Style;
        If RangeStyle.TabRange <> Null Then
            a := " (used)";
        Else
            a := " (not used)";
        End If;
        Debug.WriteLine("Style ?" + i.ToString + a);
        If TabCellStyle.Font <> Null Then
            Debug.WriteLine("   Font - " + TabCellStyle.Font.Name);
            If TabCellStyle.Font.Color <> Null Then
                Debug.WriteLine("   Font color - " + TabCellStyle.Font.Color.Name);
            End If;
        End If;
    End For;
    If count > 0 Then
        CStyles.Remove(count - 1);
    End If;
End Sub Button1OnClick;

After executing the example the console window shows information on the styles set for the working area. Then the last style is removed from the collection.

See also:

IEaxRangeCellStyles