Skip to main content

SpreadsheetOptionsExtensions.AddInitializeDocument(SpreadsheetOptions, InitializeDocumentEventHandler) Method

Connects the event with an event handler function.

Namespace: DevExpress.AspNetCore

Assembly: DevExpress.AspNetCore.Spreadsheet.v22.1.dll

Declaration

public static SpreadsheetOptions AddInitializeDocument(
    this SpreadsheetOptions spreadsheetOptions,
    InitializeDocumentEventHandler handler
)

Parameters

Name Type Description
spreadsheetOptions SpreadsheetOptions

Spreadsheet options.

handler InitializeDocumentEventHandler

A function that handles the InitializeDocument event.

Returns

Type Description
SpreadsheetOptions

An object that can be used to further configure the Spreadsheet options.

Remarks

The example below demonstrates how to handle the InitializeDocument event:

builder.Services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
builder.Services.AddDevExpressControls(options => {
    options.AddSpreadsheet(
        spreadsheetOptions => {
            spreadsheetOptions
              .AddInitializeDocument(
                  (object sender, SpreadsheetInitializeDocumentEventArgs e) => {
                      // make changes in the document model before the control opens a document for the first time
                  }
              );
        }
    );
});
See Also