Skip to main content

RichEditCustomDocumentProcessor Class

Provides methods to process a document in the Controller in a custom manner.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.1.dll

NuGet Package: DevExpress.Web.Mvc5

Declaration

public class RichEditCustomDocumentProcessor

Remarks

The RichEditCustomDocumentProcessor class implements methods that allow you to process a document in a custom manner while operating at the Controller level.

Note

Use the RichEditDocumentServer component to modify a document without user interaction. The RichEditDocumentServer is a non-visual .NET library providing all the word processing functionality.

The binding methods (RichEditCustomDocumentProcessor.Bind, RichEditCustomDocumentProcessor.BindToXML) which are implemented by the RichEditCustomDocumentProcessor are so called Controller-based additions to the View-based binding methods of the RichEditExtension.

You should bind RichEdit to its data source in both PartialView and Controller, if the following two conditions are met in your application:

  • your RichEdit should be bound to a data source,
  • you use the RichEditExtension.GetCallbackResult method in the Controller to process RichEdit callbacks (for instance, to save a document in a custom manner).

The following code sample demonstrates how this can be done.

@Html.DevExpress().RichEdit(settings => {
    settings.Name = "RichEditNameHere";
    settings.CallbackRouteValues = new { Controller = ..., Action = "ActionMethodThatHandlesRichEditCallbacks" }; 
    ...
}).Open(...).BindToXML(Server.MapPath("~/App_Data/Documents/MyData.xml")).GetHtml()
public ActionResult ActionMethodThatHandlesRichEditCallbacks() {
    return RichEditExtension.GetCallbackResult("RichEditNameHere", p => {
        p.Saving(e => {
            byte[] docBytes = RichEditExtension.SaveCopy("RichEditNameHere", DocumentFormat.Rtf);
            //saving "docBytes" to db
            e.Handled = true;
        });
        p.BindToXML(Server.MapPath("~/App_Data/Documents/MyData.xml"));
    });
}

Inheritance

Object
RichEditCustomDocumentProcessor
See Also