Back to Devexpress

SpreadsheetControl.LoadDocument(String) Method

wpf-devexpress-dot-xpf-dot-spreadsheet-dot-spreadsheetcontrol-dot-loaddocument-x28-system-dot-string-x29.md

latest3.3 KB
Original Source

SpreadsheetControl.LoadDocument(String) Method

SECURITY-RELATED CONSIDERATIONS

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

Declaration

csharp
public bool LoadDocument(
    string fileName
)
vb
Public Function LoadDocument(
    fileName As String
) As Boolean

Parameters

NameTypeDescription
fileNameString

A string specifying the path of the file to load.

|

Returns

TypeDescription
Boolean

true, if a document is loaded successfully; otherwise, false.

|

Remarks

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

csharp
{
    spreadsheetControl1.LoadDocument("PayrollCalculatorTemplate.xlsx");
    spreadsheetControl1.Document.History.IsEnabled = false;

wpf-spreadsheet-control-create-a-data-entry-form/VB/WpfDataEntryFormSample/MainWindow.xaml.vb#L24

vb
Private Sub LoadDocumentTemplate()
    spreadsheetControl1.LoadDocument("PayrollCalculatorTemplate.xlsx")
    spreadsheetControl1.Document.History.IsEnabled = False

See Also

SpreadsheetControl Class

SpreadsheetControl Members

DevExpress.Xpf.Spreadsheet Namespace