Document Management

  • 2 min to read

Users can use the commands on the File ribbon tab to manage documents.

File Tab

The sections below provide information on how to invoke the same commands from code.

Create a Document

Call the newDocument method to create a new document.


Open a Document

Call the openDocument method to open a document.

  • Call the method with parameters to open a particular document.
var documentAsBase64 = "UEsDBAoAAAAAACF<...>DAAA8NQAAAAA="
richEdit.openDocument(documentAsBase64, "DocumentName.docx", DevExpress.RichEdit.DocumentFormat.OpenXml)
  • Call the method without parameters to invoke the Open dialog.

Save a Document


If the document is not saved in the client-side or server-side event handler, the Save button and a call to the saveDocument method have no effect.

When a user clicks the Save button or the saveDocument method is called, the Rich Text Editor converts the document's content to base64 and invokes the Saving event. Write the event handler to save the document on the client side. Set the handled property to true to prevent further processing.


Use the documentSaveFormat property to specify a format in which the document will be converted to base64.

        "function(s, e) {" +
        "e.handled = true;" +
        "console.log(e.base64);" +
        "console.log(e.fileName);" +
        "console.log(e.format);" +

If the handled property is not set to true (the event is not handled), specify the ExportUrl(String) property to save the document on the server side.

   .ConfirmOnLosingChanges(c => c.Enabled(false))
public IActionResult Export(string base64, string fileName, DevExpress.AspNetCore.RichEdit.DocumentFormat format, string reason) {
    byte[] fileContents = System.Convert.FromBase64String(base64);
    return Ok();

Download a Document

Call the downloadDocument method to download a document.

//downloads the myDocument.txt file
richEdit.downloadDocument(DevExpress.RichEdit.DocumentFormat.PlainText, "myDocument");

Call the printDocument method to invoke the Print dialog.

See Also