Skip to main content

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

Opens a document in the specified format from an array of bytes.

Namespace: DevExpress.Web.ASPxRichEdit

Assembly: DevExpress.Web.ASPxRichEdit.v23.1.dll

NuGet Package: DevExpress.Web.Office


public void Open(
    string documentId,
    DocumentFormat format,
    Func<byte[]> contentAccessorByBytes


Name Type Description
documentId String

The document identifier. This value is assigned to the DocumentId property.

format DocumentFormat

The document format.

contentAccessorByBytes Func<Byte[]>

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


Call this Open method to load a document from an array of bytes. Specify the documentId parameter to identify the document. If the specified value is not unique within all open documents, the method activates the previously loaded document with the same documentId and ignores the array of bytes.

View Example: How to save/load documents to/from a database

private void CustomDocumentOpening() {
    var uniqueDocumentId = GetUniqueDocumentId();
    // Open a document from a byte array 
    ASPxRichEdit1.Open(uniqueDocumentId, DocumentFormat.Rtf, () => {
        return GetByteArrayFromCustomDocumentStorage();

private string GetUniqueDocumentId() {
    throw new NotImplementedException();
    // Obtain a previously saved DocumentId (for instance, from a database, if you have previously saved it there): 
    // return GetDocumentIdFromDatabase(); 
    // or 
    // Create a new unique identifier: 
    // return Guid.NewGuid().ToString(); 

private byte[] GetByteArrayFromCustomDocumentStorage() {
    throw new NotImplementedException();
    // Provide your custom logic to obtain a document (for instance, from a database) 
See Also