Framework / Presentation Layer / Formula Sheet / Formula Sheet

In This Topic
    Formula Sheet
    In This Topic

    The formula sheet is represented by the NFormulaSheet class. The formula sheet is in general a container for formula cells. The formula cells of a formula sheet are grouped in sections.

    Sheet Sections

    The sections of a sheet are stored in an instance of the NFormulaSectionCollection class, which can be obtained from the Sections property.

    C#
    Copy Code
    // create a new sheet and get its sections
    NFormulaSheet sheet = new NFormulaSheet(); 
    NFormulaSectionCollection sections = sheet.Sections;
    
    Visual Basic
    Copy Code
    ' create a new sheet and get its sections
    Dim sheet As New NFormulaSheet
    Dim sections As NFormulaSectionCollection = sheet.Sections
    

    You can freely add and remove sections from the sheet. See Formula Sections for more information.

     Sheet Events

    Besides being a container for formula cells, the sheet is property notified when its content changes and fires several events, which you can use. These events are:

    SectionsChanged - fired when the sections maintained by the sheet have changed (the sender argument is a reference to the sheet)

    SectionRowsChanged - fired when the rows of a section in this sheet have changed (the sender argument is a reference to the the section)

    SectionCellsChanged - fired when the cells of a section in this sheet have changed (the sender argument is a reference to the the section)

    RowCellsChanged - fired when the cells of a row in a section of this sheet have changed (the sender argument is a reference to the row)

    CellChanged - fired when a cell has changed (the sender argument is a reference to the cell)

    CellsChanged - fired when a multiple cells from the sheet have changed (the sender argument is a reference to the sheet)

    Changed - fired when the sheet has changed (the sender argument is a reference to the sheet). This event is fired after any of the above events.

     Sheet Updates

    It is often required to perform several changes in the sheet at a time. In order to optimize the sheet performance, you can use the BeginUpdate and EndUpdate methods.

    C#
    Copy Code
    sheet.BeginUpdate();
    // do sheet changes here
    sheet.EndUpdate();
    
    Visual Basic
    Copy Code
    sheet.BeginUpdate()
    ' do sheet changes here
    sheet.EndUpdate()
    
    The default implementation of these methods locks/unlocks the events, which the sheet fires and locks/unlocks the cache invalidation. You can also do this manually with the help of the LockEvents and LockCacheInvalidation properties.

    Some formula sheets can cache the precalculated content of some of their sections (for example the shape sheet caches a matrix, which represents the content of its transform section). The proper place to mark any cached content as invalid is in an override of the InvalidateCache virtual method. The NFormulaSheet class will properly call it when the cache may not already be up to date.
     Sheet Verbs
    Visually the formula sheet is edited with verbs. The verbs, which the sheet supports can be obtained from the GetVerbs method.
    See Also