Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

SpreadsheetOptionsExtensions.AddInitializeDocument(SpreadsheetOptions, InitializeDocumentEventHandler) Method

Connects the event with an event handler function.

Namespace: DevExpress.AspNetCore

Assembly: DevExpress.AspNetCore.Spreadsheet.v24.2.dll

NuGet Package: DevExpress.AspNetCore.Spreadsheet

#Declaration

C#
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