IDocument.MimeType

Syntax

MimeType: String;

Description

The MimeType property determines the type of the contents stored in the document.

Comments

The MIME type is held in the given resource compared with the loaded file extension. The MIME types determine the methods with the help of which the application processes binary data. The MimeType property should be set in the application/type format, where application represents application or application class (such as video), and type represents the MIME unique type. Slash is obligatory.

The MIME types associated with any extension can be found in the registry in the HKEY_CLASSES_ROOT\.*** branch in the Content Type parameter. Information about the MIME types registered on the computer is held in the HKEY_CLASSES_ROOT\MIME\Database\Content Type registry branch.

NOTE. More detailed description about the MIME types and their use is in the MSDN.

Example

Executing the example requires a form with the Button1 button, the ImageBox component named ImageBox1 and the Document repository object with the Document_1 identifier.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    MB: IMetabase;
    Doc: IDocument;
Begin
    MB := MetabaseClass.Active;
    Doc := MB.ItemById("Document_1").Bind As IDocument;
    If Doc.MimeType.IndexOf("image") <> -1 Then
        ImageBox1.LoadImageFromStream(Doc.GetAsStream);
    End If;
End Sub Button1OnClick;

After executing the example on pressing the button, if the document contains any graphic image, it is loaded into the ImageBox1 component.

See also:

IDocument