RichEditControl.CreateDocumentServer() Method
Gets an object implementing the IRichEditDocumentServer interface.
Namespace: DevExpress.XtraRichEdit
Assembly: DevExpress.XtraRichEdit.v24.2.dll
Declaration
Returns
Type | Description |
---|---|
IRichEditDocumentServer | An object with the IRichEditDocumentServer interface. |
Remarks
Obtains an object that can be used instead of the RichEditDocumentServer instance. The CreateDocumentServer method is implemented for Mail Merge technique.
Example
The following code creates an instance of Word Processing Document API, loads a document from the stream with the IRichEditDocumentServer.LoadDocument method and inserts the content of the document in the RichEditControl at the caret position using the SubDocument.InsertDocumentContent method.
The RichEditControl instance is passed to the BarItem.ItemClick event handler using the BarItem.Tag property.
static void buttonCustomAction_ItemClick_DocumentServer(object sender, ItemClickEventArgs e) {
RichEditControl richEdit = e.Item.Tag as RichEditControl;
IRichEditDocumentServer server = richEdit.CreateDocumentServer();
using(System.IO.FileStream fs = new System.IO.FileStream("Documents\\DocumentServerTest.docx", System.IO.FileMode.Open)) {
server.LoadDocument(fs, DevExpress.XtraRichEdit.DocumentFormat.OpenXml);
richEdit.Document.InsertDocumentContent(richEdit.Document.CaretPosition, server.Document.Range);
}
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the CreateDocumentServer() method.
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.