Reader / Writer

<< Click to Display Table of Contents >>

Navigation:  Appendix > MIME Import / Export >

Reader / Writer

To activate MIME support please add the unit WPIOMime to the uses clause. (C++Builder requires #pragma link).

 

Now it is possible to load *.MHT, *.MSG and *.EML files. These file extensions automatically trigger the MIME reader and writer classes due to the class methods.

 

class function TWPMimeReader.UseForFilterName(const Filtername: string): Boolean;

begin

 Result := (CompareText(Filtername, 'TWPMimeReader') = 0) // not "inherited"

  or (CompareText(Filtername, 'MIME') = 0)

  or (CompareText(Filtername, 'MHT') = 0)

  or (CompareText(Filtername, 'MSG') = 0)

  or (CompareText(Filtername, 'EML') = 0);

end;

 

and

 

class function TWPMimeWriter.UseForFilterName(const Filtername: string): Boolean;

begin

 Result := (CompareText(Filtername, 'TWPMimeWriter') = 0) // not "inherited"

  or (CompareText(Filtername, 'MIME') = 0)

  or (CompareText(Filtername, 'MHT') = 0)

  or (CompareText(Filtername, 'MSG') = 0)

  or (CompareText(Filtername, 'EML') = 0);

end;

 

The writer supports the format options:

-nohtml, do not save HTML text

-noplain, do not save PLAIN text

 

The MimeReader initializes and fills the property TWPCustomTextReader.CopyOfBodyData with a copy of the HTML text which is loaded as body. The data can be used to display the HTML source code (example).