wpf-devexpress-dot-xpf-dot-spreadsheet-dot-spreadsheetcontrol-dot-loaddocument-x28-system-dot-string-x29.md
Using file paths sourced from untrusted input may expose unauthorized files or allow unintended file access. Always validate and normalize all external paths to prevent path manipulation.
Loads the specified file.
Namespace : DevExpress.Xpf.Spreadsheet
Assembly : DevExpress.Xpf.Spreadsheet.v25.2.dll
NuGet Package : DevExpress.Wpf.Spreadsheet
public bool LoadDocument(
string fileName
)
Public Function LoadDocument(
fileName As String
) As Boolean
| Name | Type | Description |
|---|---|---|
| fileName | String |
A string specifying the path of the file to load.
|
| Type | Description |
|---|---|
| Boolean |
true, if a document is loaded successfully; otherwise, false.
|
When you use this method to load a document from a file, the document format is identified automatically based on its content (regardless of the filename extension).
If the data has an incorrect format, the SpreadsheetControl.InvalidFormatException event fires.
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the LoadDocument(String) method.
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.
wpf-spreadsheet-control-create-a-data-entry-form/CS/WpfDataEntryFormSample/MainWindow.xaml.cs#L26
{
spreadsheetControl1.LoadDocument("PayrollCalculatorTemplate.xlsx");
spreadsheetControl1.Document.History.IsEnabled = false;
wpf-spreadsheet-control-create-a-data-entry-form/VB/WpfDataEntryFormSample/MainWindow.xaml.vb#L24
Private Sub LoadDocumentTemplate()
spreadsheetControl1.LoadDocument("PayrollCalculatorTemplate.xlsx")
spreadsheetControl1.Document.History.IsEnabled = False
See Also