IWebRichTextValueStorage Interface
Declares members of the Rich Text editor’s value storage.
Namespace: DevExpress.ExpressApp.Office.Web
Assembly: DevExpress.ExpressApp.Office.Web.v24.1.dll
NuGet Package: DevExpress.ExpressApp.Office.Web
Declaration
Remarks
A Rich Text editor’s value storage allows you to implement custom logic executed when saving or loading a RichText document. Follow the steps below to create a custom value storage that overrides a file storage format.
In the ASP.NET Web Forms Module project, create a class that implements the IWebRichTextValueStorage interface as shown below:
using DevExpress.ExpressApp.Office.Web; using DevExpress.Web.ASPxRichEdit; using DevExpress.XtraRichEdit; using System.IO; // ... public class WebMhtRichTextValueStorage : IWebRichTextValueStorage { public object GetValue(ASPxRichEdit control) { using (MemoryStream memoryStream = new MemoryStream()) { control.SaveCopy(memoryStream, DocumentFormat.MhtText); using (StreamReader streamReader = new StreamReader(memoryStream)) { memoryStream.Seek(0, SeekOrigin.Begin); return streamReader.ReadToEnd(); } } } public void SetValue(ASPxRichEdit control, object propertyValue, string documentID) { control.Open(documentID, DocumentFormat.MhtText, () => (byte[])propertyValue); } }
Create a View Controller and access the ASPxRichTextPropertyEditor as described in the Ways to Access UI Elements and Their Controls topic. Set the editor’s ValueStorage property to an instance of WebCustomRichTextValueStorage as shown below:
using DevExpress.ExpressApp; using DevExpress.ExpressApp.Office.Web; // ... public class WebRichTextValueStorageController : ObjectViewController<DetailView, Document> { protected override void OnActivated() { base.OnActivated(); ASPxRichTextPropertyEditor richTextPropertyEditor = View.FindItem("Text") as ASPxRichTextPropertyEditor; if (richTextPropertyEditor != null) { richTextPropertyEditor.ValueStorage = new WebMhtRichTextValueStorage(); } } }