You are viewing help content for pre-release software. This document and the features it describes are subject to change. Switch to the current version.

Use Rich Text Documents in Business Objects

  • 2 minutes to read

This topic describes how to use the DevExpress.ExpressApp.Office.Win.RichTextPropertyEditor, DevExpress.ExpressApp.Office.Web.ASPxRichTextPropertyEditor, and DevExpress.ExpressApp.Office.Blazor.Editors.RichTextPropertyEditor for byte array and string properties in WinForms, ASP.NET Web Forms and for ASP.NET Core Blazor applications. The following images demonstrate these Property Editors assigned to the Document.Text property:

Assign the Rich Text Property Editor to a Business Class’ Property

In Code

To enable the Rich Text Property Editors for a business class’ property, apply the EditorAliasAttribute to this property as follows:

using DevExpress.ExpressApp.Editors;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
// ...
// Byte array property example:
private byte[] text;
[EditorAlias(EditorAliases.RichTextPropertyEditor)] 
public byte[] Text { 
    get { return text; }
    set { SetPropertyValue(nameof(Text), ref text, value); }
}

// String property example:
private string text;
[Size(SizeAttribute.Unlimited)]
[EditorAlias(EditorAliases.RichTextPropertyEditor)] 
public string Text { 
    get { return text; }
    set { SetPropertyValue(nameof(Text), ref text, value); }
}

In the Model Editor

Navigate to the required Views | <DetailView> | Items | <PropertyEditor> node and set the PropertyEditorType property to DevExpress.ExpressApp.Office.Win.RichTextPropertyEditor, DevExpress.ExpressApp.Office.Web.ASPxRichTextPropertyEditor, or DevExpress.ExpressApp.Office.Blazor.Editors.RichTextPropertyEditor.

Document Storage Formats

In ASP.NET Web Forms and ASP.NET Core Blazor applications, when you use the Rich Text Property Editors for a byte array property, your application saves the documents in the DOCX format. The RTF format is used for string properties. Note that you can also optionally change the format to HTML. We recommend using byte arrays instead of strings to store your documents because the DOCX format works faster with large documents and supports more formatting options.

Edit the Document in a Separate Window

In WinForms applications, you can open the document in a new modal window using the Show in popup context menu command.

In ASP.NET Web Forms applications, you can edit the document in full-screen mode.

See Also