ASPxRichEdit.Open(String, DocumentFormat, Func<Stream>) Method
Opens a document in the specified format from a stream.
Namespace: DevExpress.Web.ASPxRichEdit
Assembly: DevExpress.Web.ASPxRichEdit.v24.2.dll
Declaration
public void Open(
string documentId,
DocumentFormat format,
Func<Stream> contentAccessorByStream
)
Parameters
Name | Type | Description |
---|---|---|
documentId | String | The document identifier. This value is assigned to the DocumentId property. |
format | DocumentFormat | The document format. |
contentAccessorByStream | Func<Stream> | A method delegate to obtain a stream from which to open the document. |
Remarks
Call this Open method to load a document from a stream. 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 stream data.
private void CustomDocumentOpening() {
var uniqueDocumentId = GetUniqueDocumentId();
Stream stream = null;
// Open a document from a stream
ASPxRichEdit1.Open(uniqueDocumentId, DocumentFormat.Rtf, () => {
return GetStreamFromCustomDocumentStorage();
});
if (stream != null)
stream.Dispose();
}
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 FileStream GetStreamFromCustomDocumentStorage() {
throw new NotImplementedException();
// Provide your custom logic to obtain a document (for instance, from a database)
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Open(String, DocumentFormat, Func<Stream>) 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.