Back to Devexpress

ASPxSpreadsheet.New() Method

aspnet-devexpress-dot-web-dot-aspxspreadsheet-dot-aspxspreadsheet-917c004e.md

latest3.3 KB
Original Source

ASPxSpreadsheet.New() Method

Creates a document in the ASPxSpreadsheet.

Namespace : DevExpress.Web.ASPxSpreadsheet

Assembly : DevExpress.Web.ASPxSpreadsheet.v25.2.dll

NuGet Package : DevExpress.Web.Office

Declaration

csharp
public void New()
vb
Public Sub New

Remarks

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.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the New() 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.

asp-net-core-spreadsheet-update-document/CS/UpdateDocumentUsingAJAX/Controllers/HomeController.cs#L72

csharp
var spreadsheet = SpreadsheetRequestProcessor.GetSpreadsheetFromState(spreadsheetState);
spreadsheet.New();
FillInDocument(spreadsheet.Document.Worksheets[0]);

See Also

Open

Create a Document

ASPxSpreadsheet Class

ASPxSpreadsheet Members

DevExpress.Web.ASPxSpreadsheet Namespace