Skip to main content

DocumentManager.CloseDocument(String) Method

Closes a document with the specified ID.

Namespace: DevExpress.Web.Office

Assembly: DevExpress.Web.v22.1.dll

NuGet Package: DevExpress.Web

Declaration

public static void CloseDocument(
    string documentId
)

Parameters

Name Type Description
documentId String

The unique identifier of a document.

Remarks

Office controls (ASPxSpreadsheet and ASPxRichEdit) do not close a document when you open another document or even when you leave a page with the control. The document storage retains the document until it is hibernated and then removed from the memory after a dispose timeout. If the hibernation is disabled, the document remains in the storage until IIS process recycling occurs.

Call the CloseDocument methods to close a document explicitly:

DocumentManager.CloseDocument(ASPxSpreadsheet1.DocumentId);

Call the CloseAllDocuments() method to close all open documents.

DocumentManager.CloseAllDocuments();

When you close a document, DocumentManager closes it for all users who work on the document. It can cause NullReferenceException and “Your session has expired” errors. To avoid these errors, close unshared documents only.

See Also