Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

IFormatDetectorService Interface

Allows detecting the format of the document contained in the stream.

Namespace: DevExpress.XtraRichEdit.Services

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

Declaration

public interface IFormatDetectorService

Remarks

Built-in implementation of the IFormatDetectorService service detects supported document formats by file signature, by the structure of the inner zip archive and by the presence of certain elements. You can implement your own format detector and register it as a service for use in your application.

Example

This code snippet uses the IFormatDetectorService.DetectFormat method to determine the format of the document contained in the stream for subsequent loading with the RichEditControl.LoadDocument method.

using (Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("LoadDocumentExample.TextWithImagesODT"))
    {
    DocumentFormat format = richEditControl1.GetService<IFormatDetectorService>().DetectFormat(stream);
    richEditControl1.LoadDocument(stream, format);
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the IFormatDetectorService interface.

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.

See Also