Skip to main content

SpreadsheetExtension.Open(String, String, DocumentFormat, Func<Stream>) Method

Opens a document specified by a stream.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.1.dll

NuGet Package: DevExpress.Web.Mvc5

Declaration

public static ActionResult Open(
    string extensionName,
    string uniqueDocumentID,
    DocumentFormat format,
    Func<Stream> contentAccessorByStream
)

Parameters

Name Type Description
extensionName String

A string value that specifies the Spreadsheet name.

uniqueDocumentID String

A string value that uniquely identifies the document to open (the document’s DocumentId).

format DocumentFormat

A DocumentFormat object specifying the document format.

contentAccessorByStream Func<Stream>

A method delegate to obtain a stream from which to open the document.

Returns

Type Description
ActionResult

A ActionResult object that represents the result of the operation.

Remarks

This method tries to find the specified document in a list of already opened documents maintained by the DocumentManager. If the document is found, its instance is opened in Spreadsheet. If the specified document has not been found in the opened documents, a delegate method specified by the contentAccessorByStream parameter is called. It allows you to manually obtain a steam from which to open a document (for instance, to load a document from a database).

Note that the Open method uses the control’s parameters stored as an additional parameter of the control’s work session to restore all the control’s settings and return a relevant partial view in a controller action. It is recommended to avoid using the DocumentManager.CloseAllDocuments method that clears all the session parameters, including control settings and close only specific documents using the document names.

Alternatively, you can open documents by passing a document name from a controller to a partial view using the View Data collection and invoking the Open method directly in the partial view.

See Also