Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

IFormatDetectorService Interface

When implemented, allows you to detect the format of the document contained in the stream.

Namespace: DevExpress.XtraRichEdit.Services

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

NuGet Package: DevExpress.RichEdit.Core

#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);
}
See Also