Skip to main content

SpreadsheetExtension.Open(String, Func<Byte[]>) Method

Opens a document specified by an array of bytes.

Namespace: DevExpress.Web.Mvc

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

NuGet Package: DevExpress.Web.Mvc5

Declaration

public SpreadsheetExtension Open(
    string documentId,
    Func<byte[]> contentAccessorByBytes
)

Parameters

Name Type Description
documentId String

A string value that specifies the Spreadsheet name.

contentAccessorByBytes Func<Byte[]>

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

Returns

Type Description
SpreadsheetExtension

A SpreadsheetExtension object that represents the result of the operation.

Remarks

Note

This overload of the SpreadsheetExtension.Open method determines a document’s format automatically, but this process reduces the method’s performance. You can accelerate the method’s performance by specifying a document’s format manually using the overload with the DocumentFormat parameter.

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 contentAccessorByBytes parameter is called. It allows you to manually obtain a byte array from which to open a document (for instance, to load a document from a database).

If the method causes the DevExpress.XtraSpreadsheet.SpreadsheetUnsupportedFormatException exception, call the Open(String, String, DocumentFormat, Func<Byte[]>) method instead and specify the document format explicitly.

See Also