IPivotEvents.OnPivotTableCellChange

Syntax

OnPivotTableCellChange(Value: IPivotTableCellEventArgs);

Parameters

Value. Event argument that allows information about cell.

Description

The OnPivotTableCellChange method implements the event that occurs on changing table cell data.

Example

Executing the example requires that the repository contains a form with the UiErAnalyzer component named UiErAnalyzer1 and the EaxDocumentViewerBox component. UiErAnalyzer1 is set as a data source for EaxDocumentViewerBox. A express report is connected to UiErAnalyzer1.

Add links to the Dimensions, Express, Pivot system assemblies.

Public Class Pivot_Events: PivotEvents
    // Event that occurs on cell editing
    Public Sub OnPivotTableCellChange(Value: IPivotTableCellEventArgs);
    Begin
        Debug.WriteLine("Cell is changed " + Value.Row.ToString + ":" + Value.Column.ToString);
        If (Value.Row > 10And (Value.Column > 10Then
            Debug.WriteLine("Cell is outside allowed range. Editing is prohibited.");
            Value.Cancel := True;
        End If;
    End Sub OnPivotTableCellChange;
    // Event that occurs after cell editing
    Public Sub OnPivotTableCellChanged(Value: IPivotTableCellChangeEventArgs);
    Begin
        Debug.WriteLine("Cell is changed. New value: " + Value.NewValue);
    End Sub OnPivotTableCellChanged;
End Class Pivot_Events;

Class TESTForm: Form
    UiErAnalyzer1: UiErAnalyzer;
    EaxDocumentViewerBox1: EaxDocumentViewerBox;
    Pvt: IPivot;
    Cookie: Integer;

    Sub TESTFormOnShow(Sender: Object; Args: IEventArgs);
    Var
        Express: IEaxAnalyzer;
        Events: Pivot_Events;
    Begin
        // Get express report
        Express := UiErAnalyzer1.ErAnalyzer;
        // Get settings for displaying report data table
        Pvt := Express.Pivot;
        // Allow event generation
        Pvt.EventsEnabled := True;
        // Create an class instance for event handling
        Events := New Pivot_Events.Create;
        // Connect table event handler
        Cookie := Pvt.AddEventHandler(Events);
    End Sub TESTFormOnShow;

    Sub TESTFormOnClose(Sender: Object; Args: IEventArgs);
    Begin
        // Remove event handler
        Pvt.RemoveEventHandler(Cookie);
    End Sub TESTFormOnClose;
End Class TESTForm;

When a form is started, a custom event handler is connected for express report table. If cells are edited, the development environment console registers coordinates of cells and the new value. If the edited cell is outside the range of ten rows and columns, editing lock icon is displayed for the cell.

See also:

IPivotEvents