windowsforms-devexpress-dot-xtraspreadsheet-dot-spreadsheetcontrol-56d91fb7.md
Occurs after a document is loaded into the Spreadsheet control.
Namespace : DevExpress.XtraSpreadsheet
Assembly : DevExpress.XtraSpreadsheet.v25.2.dll
NuGet Package : DevExpress.Win.Spreadsheet
public event EventHandler DocumentLoaded
Public Event DocumentLoaded As EventHandler
The DocumentLoaded event's data class is EventArgs.
The DocumentLoaded event fires after the LoadDocument method of the SpreadsheetControl or IWorkbook object is executed. It occurs when the document model is built and the loaded document is valid. Handle this event to ensure that a document is loaded completely and you can safely modify it.
The example below shows how to use the DocumentLoaded event to recalculate all formulas in the loaded document.
spreadsheetControl.DocumentLoaded += SpreadsheetControl_DocumentLoaded;
// ...
private void SpreadsheetControl_DocumentLoaded(object sender, System.EventArgs e)
{
spreadsheetControl.Document.CalculateFull();
}
AddHandler spreadsheetControl.DocumentLoaded, AddressOf SpreadsheetControl_DocumentLoaded
' ...
Private Sub SpreadsheetControl_DocumentLoaded(sender As Object, e As EventArgs)
spreadsheetControl.Document.CalculateFull()
End Sub
The following code snippets (auto-collected from DevExpress Examples) contain references to the DocumentLoaded event.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
winforms-spreadsheet-use-formula-engine/CS/FormulaEngineTest/Form1.cs#L25
SetCellContext();
spreadsheetControl1.DocumentLoaded += spreadsheetControl1_DocumentLoaded;
spreadsheetControl1.ActiveCell.Formula = "SUM(R[1]C:R[2]C)";
winforms-spreadsheet-assign-custom-in-place-editors/CS/Spreadsheet_CustomCellEditors/Form1.cs#L15
spreadsheetControl.DocumentLoaded += spreadsheetControl1_DocumentLoaded;
#region #CustomCellEdit
winforms-spreadsheet-use-formula-engine/VB/FormulaEngineTest/Form1.vb#L24
SetCellContext()
AddHandler spreadsheetControl1.DocumentLoaded, AddressOf spreadsheetControl1_DocumentLoaded
spreadsheetControl1.ActiveCell.Formula = "SUM(R[1]C:R[2]C)"
winforms-spreadsheet-assign-custom-in-place-editors/VB/Spreadsheet_CustomCellEditors/Form1.vb#L14
spreadsheetControl.LoadDocument("Documents\Document.xlsx", DocumentFormat.Xlsx)
AddHandler spreadsheetControl.DocumentLoaded, AddressOf spreadsheetControl1_DocumentLoaded
#Region "#CustomCellEdit"
See Also