ILanerTable.ColumnCount

Syntax

ColumnCount: Integer;

Description

The ColumnCount property returns the columns count of the table.

Comments

To get the number of rows in the table, use the ILanerTable.RowCount property.

Example

Executing the example requires that the repository contains a workbook with the WORKBOOK_SERIES identifier.

Add links to the Express, Laner, MathFin, MEtabase system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    WbkObj: IMetabaseObject;
    EaxAn: IEaxAnalyzer;
    Laner: ILaner;
    LanerTbl: ILanerTable;
    i, j: Integer;
Begin
    
// Get workbook
    mb := MetabaseClass.Active;
    WbkObj := mb.ItemById(
"WORKBOOK_SERIES").Edit;
    EaxAn := WbkObj 
As IEaxAnalyzer;
    
// Get object to set up workbook
    Laner := EaxAn.Laner;
    
// Get workbook table
    LanerTbl := Laner.Execute;
    
// Turn the table to the edit mode
    If Not LanerTbl.IsEditing Then
        LanerTbl.Edit;
    
End If;
    
// Fill the table with random numbers
    For i := 0 To LanerTbl.RowCount - 1 Do
        
For j := 0 To LanerTbl.ColumnCount - 1 Do
            
If LanerTbl.IsEditableCell(i, j) Then
                LanerTbl.Cell(i, j) := Math.RandBetween(
0100);
            
End If;
        
End For;
    
End For;
    
If LanerTbl.RowCount > 4 Then
        
// If there are more than four rows in the table, undo the changes
        Laner.Update;
    
Else
        
// If there are less than for rows in the table, save the changes
        LanerTbl.Post;
    
End If;
    
// Save changes in the workbook  
    WbkObj.Save;
End Sub UserProc;

After executing the example random values are generated for all the table cells available for editing. If there are less than four rows in the table, data changes are saved, if more than four rows - data changes are undone.

See also:

ILanerTable