Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Collapse]Rich Text Editor
    Overview
   [Expand]Getting Started
   [Expand]Fundamentals
   [Expand]Concepts
   [Expand]Visual Elements
   [Collapse]Examples
    [Collapse]Files
      How to: Create a New Document with the RichEdit Control
      How to: Load a Document into the RichEdit Control
      How to: Save a Document in the RichEdit Control
    [Expand]Text
    [Expand]Formatting
    [Expand]Styles
    [Expand]Lists
    [Expand]Pictures
    [Expand]Text Boxes
    [Expand]Tables
    [Expand]Layout
    [Expand]Automation
    [Expand]Search and Replace
    [Expand]Mail Merge
    [Expand]Spell Check
    [Expand]Export-Import
    [Expand]Printing
    [Expand]Protection
    [Expand]User Interface Customization
    [Expand]Miscellaneous
    [Expand]Commands
   [Expand]Member Tables
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Load a Document into the RichEdit Control

You can load a document from a file, a data stream or a string, as the code snippets illustrate.

Events related to document loading are listed in the following table:

Event

Description

RichEditControl.BeforeImport Occurs before a document is loaded (imported from an external source).
RichEditControl.InitializeDocument Occurs before a document is loaded. Handle this event to set initial document settings.
RichEditControl.DocumentLoaded Occurs after a document is loaded into the RichEdit control.
RichEditControl.InvalidFormatException Fires when the supplied data could not be recognized as data in the assumed format for import.
RichEditControl.UnhandledException This event is raised when an unhandled exception of the RichEditControl occurs.
Tip

Use RichEditControl Event Viewer application to explore events in detail.

Expanded From File

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E1222.

Expanded From Stream

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E1222.

This code snippet uses the IFormatDetectorService.DetectFormat method to determine the format of the document contained in the stream for subsequent loading with the RichEditControl.LoadDocument method.

Expanded From String

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E1222.

This code snippet uses the RichEditControl.RtfText property to load a document from a string in RTF format. It displays the word "Test" in blue.

Expanded See Also

How would you rate this topic?​​​​​​​