Opening Workbook, Changing Data and Saving Changes

Executing the example requires that the repository contains a workbook with the OBJ123 identifier in which data is changed and saved.

Add links to the following system assemblies:

Example

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Exp: IEaxAnalyzer;
    WB: ILaner;
    Table: ILanerTable;
    i, j: Integer;
Begin
    MB := MetabaseClass.Active;
    //Open a workbook to edit
    MObj := MB.ItemById("OBJ123").Edit;
    Exp := MObj As IEaxAnalyzer;
    WB := Exp.Laner;
    //Get a workbook table
    Table := WB.Execute;
    //Enable table editing
    If Not Table.IsEditing Then
        Table.Edit;
    End If;
    //Assign random values from 0 to 100 to all available table cells
    For i := 0 To Table.RowCount - 1 Do
    For j := 0 To Table.ColumnCount - 1 Do
    If Table.IsEditableCell(i, j) Then
    Table.Cell(i, j) := Math.RandBetween(0100);
    End If;
    End For;
    End For;
    //Save changes
    Table.Post;
    Table.Update;
    MObj.Save;
End Sub UserProc;

After executing the example the workbook with the defined identifier is opened to edit. Data in the workbook table is replaced with the random values from 0 to 100.

See also:

Examples | ILaner | ILanerTable