Skip to main content
A newer version of this page is available. .

RichEditDocumentServer Class

A non-visual rich text engine providing all the RichEditControl functionality except user interface features.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.RichEdit.v17.2.Core.dll

Declaration

[ComVisible(true)]
public class RichEditDocumentServer :
    IRichEditDocumentServer,
    IBatchUpdateable,
    IServiceContainer,
    IServiceProvider,
    IDisposable,
    IInternalRichEditDocumentServerOwner,
    IPrintable,
    IBasePrintable

Remarks

The RichEditDocumentServer is the core object of rich editors for all platforms (XtraRichEdit, DXRichEdit for WPF) .

The RichEditDocumentServer API is similar to that of the RichEditControl, with the exclusion of methods or services that rely upon keyboard or mouse events (such as RichEditControl.GetPositionFromPoint).

Use the RichEditDocumentServer component to modify a document without user interaction, via the RichEdit application programming interface (API). It enables you to automatically create or load documents, modify, save them to any supported document formats or perform mail merge.

The Master-detail reporting technique uses the RichEditDocumentServer functionality extensively.

Medium trust level applications on web servers can also benefit from the RichEditDocumentServer component, since it enables server-side document processing and supports constructing document web services. To learn more, review the How to use RichEditDocumentServer to implement automatic Document to PDF converter on a web server example.

Example

The following code snippet creates a new document, modifies and prints it using the RichEditDocumentServer component.

using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;
using DevExpress.XtraPrinting;
    RichEditDocumentServer richServer = new RichEditDocumentServer();
    // Specify default formatting
    richServer.Document.DefaultParagraphProperties.Alignment = ParagraphAlignment.Center;
    // Specify page settings
    richServer.Document.Sections[0].Page.Landscape = true;
    richServer.Document.Sections[0].Page.Height = DevExpress.Office.Utils.Units.InchesToDocumentsF(10.0f);
    richServer.Document.Sections[0].Page.Width = DevExpress.Office.Utils.Units.InchesToDocumentsF(4.5f);
    // Add document content
    richServer.Document.AppendText("This content is created programmatically\n");
    richServer.Document.AppendParagraph();
    InsertTableIntoDocument(richServer);
    // Invoke the Print Preview dialog
    using (PrintingSystem printingSystem = new PrintingSystem()) {
        using (PrintableComponentLink link = new PrintableComponentLink(printingSystem)) {
            link.Component = richServer;
            link.CreateDocument();
            link.ShowPreviewDialog();
        }
    }

The following code snippets (auto-collected from DevExpress Examples) contain references to the RichEditDocumentServer class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

Inheritance

Object
RichEditDocumentServer
See Also