Back to Devexpress

Create a Document

aspnet-117677-components-spreadsheet-document-management-create-a-document.md

latest1.3 KB
Original Source

Create a Document

  • Sep 17, 2021

Call the New() method to create a document.

A new document has an empty DocumentID value, thus the document is not accessible from the DocumentManager API. The ASPxSpreadsheet retains such a document until the control switches to another document.

The ASPxSpreadsheet generates a DocumentID value for the document when a user saves it to a file system. Alternatively, you can assign a GUID to the DocumentId property explicitly:

csharp
ASPxSpreadsheet1.New();
ASPxSpreadsheet1.DocumentId = Guid.NewGuid().ToString();
vb
ASPxSpreadsheet1.New()
ASPxSpreadsheet1.DocumentId = Guid.NewGuid.ToString()

If the specified DocumentID value is not unique within all open documents, the ASPxSpreadsheet throws an exception. Call the GetAllDocuments() method to get identifiers of all open documents.