Skip to main content

How to: Determine Formatting Capabilities Required to Export the Document

This example illustrates how to check if specific formatting features are contained in the document loaded in the RichEditControl, and determine whether an exporter can perform the document export correctly.

The Document.RequiredExportCapabilities property provides access to an object which has several properties, indicating whether a particular formatting feature is used.

The following code snippet illustrates how you can detect if the capabilities of your custom exporter match the formatting capabilities required to export the current document. First, declare the exporter capabilities in the DocumentExportCapabilities structure, and then compare it with the structure obtained via the Document.RequiredExportCapabilities property.

using DevExpress.XtraRichEdit;

DocumentExportCapabilities myExportFeatures = 
    new DevExpress.XtraRichEdit.DocumentExportCapabilities();
myExportFeatures.CharacterFormatting = true;
myExportFeatures.ParagraphFormatting = true;
myExportFeatures.InlinePictures= true;

if(myExportFeatures.Contains(richEditControl1.Document.RequiredExportCapabilities))
    MessageBox.Show("The document can be exported");