The requested page is not available for the requested platform. You are viewing the content for Default platform.

RichEditCustomDocumentProcessor Class

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

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v19.2.dll

Declaration

public class RichEditCustomDocumentProcessor
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.

Example: RichEdit - How to insert a table based on a DataTable object

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.

PartialView:


@Html.DevExpress().RichEdit(settings => {
    settings.Name = "RichEditNameHere";
    settings.CallbackRouteValues = new { Controller = ..., Action = "ActionMethodThatHandlesRichEditCallbacks" }; 
    ...
}).Open(...).BindToXML(Server.MapPath("~/App_Data/Documents/MyData.xml")).GetHtml()

Controller:


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