Skip to main content
A newer version of this page is available. .

SpreadsheetControl.CreateNewDocument() Method

Creates and loads a new empty workbook.

Namespace: DevExpress.XtraSpreadsheet

Assembly: DevExpress.XtraSpreadsheet.v19.2.dll

Declaration

public bool CreateNewDocument()

Returns

Type Description
Boolean

true, if the document is created successfully; otherwise, false.

Remarks

If the WorkbookEventOptions.RaiseOnModificationsViaAPI property is set to true and the SpreadsheetControl’s document has unsaved changes (the SpreadsheetControl.Modified property is true), the CreateNewDocument method call raises the SpreadsheetControl.DocumentClosing event.

Set e.Cancel to true in the SpreadsheetControl.DocumentClosing event handler to prevent a document from closing. In this case, the CreateNewDocument method returns false.

If the new document was created and successfully loaded, the CreateNewDocument method returns true.

The following code snippets (auto-collected from DevExpress Examples) contain references to the CreateNewDocument() 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.

See Also