Skip to main content

TdxHtmlDocumentImporterOptions.AutoDetectEncoding Property

Specifies if HTML import routines detect document encoding automatically.

Declaration

property AutoDetectEncoding: Boolean read; write; default True;

Property Value

Type Default Description
Boolean True
True
Default. HTML import routines detect source document encoding automatically; the Encoding property is ignored.
False
The Encoding property specifies the target encoding.

Remarks

TdxRichEditControl and TdxRichEditDocumentServer components detect encoding for imported documents automatically. You can use AutoDetectEncoding and Encoding properties to specify the required encoding for imported HTML documents explicitly.

Code Example: Use UTF-7 to Import HTML Documents

The following code example defines the UTF-7 encoding to load an HTML document:

uses
  dxRichEdit.DocumentServer,  // Declares the TdxRichEditDocumentServer component
  dxRichEdit.Html;  // Declares HTML format implementation

// ...

var
  ADocumentServer: TdxRichEditDocumentServer;
begin
  ADocumentServer := TdxRichEditDocumentServer.Create(nil);
  try
    ADocumentServer.Options.Import.Html.AutoDetectEncoding := False;
    ADocumentServer.Options.Import.Html.Encoding := CP_UTF7;
    ADocumentServer.LoadDocument('Document1.html');
    // Your document processing code
  finally
    ADocumentServer.Free;
  end;
end;

Default Value

The AutoDetectEncoding property’s default value is True.

See Also