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: Create a New Document with the RichEdit Control

The RichEditControl.CreateNewDocument method is used to create a new document in the RichEditControl. The CreateEmptyDocumentCommand command associated with the CTRL-N key combination is also used for this purpose.

The RichEditControl.EmptyDocumentCreated event is raised after a new document is created.

Show Me

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

Note

You can set the RichEditControl.Text property to an empty string to clear the control's content.

The Document.DefaultCharacterProperties and the Document.DefaultParagraphProperties properties enable you to specify default formatting for the newly created document.

You can also use the RichEditControl.LoadDocumentTemplate method to load a document and leave the DocumentSaveOptions.CurrentFileName and the DocumentSaveOptions.CurrentFormat intact. Thus, the document will not be automatically overwritten if the SaveDocumentCommand command is executed or the RichEditControl.SaveDocument is called. An attempt to save a document that was loaded as a template invokes the Save As... dialog, which enables the end-user to specify a different file name and format.

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