How to extract .msg file from Outlook to TrichView
Posted: Mon Oct 02, 2023 2:28 am
Hello, Can you guide me on how to extract .msg file from Outlook to Trichview? I'm looking for how to do it but without success. Thanks
Support forums for TRichView, ScaleRichView, Report Workshop and RVMedia components
https://textally.com/forums/
Code: Select all
var
MI: _MailItem;
Stream: TMemoryStream;
Body: UnicodeString;
begin
MI := App.Session.OpenSharedItem(FILENAME) as _MailItem;
txtSubject.Text := MI.Subject;
Stream := TMemoryStream.Create;
Body := MI.HTMLBody;
Stream.WriteBuffer(PWideChar(Body)^, Length(Body) * sizeof(WideChar));
Stream.Position := 0;
RichViewEdit1.Clear;
RichViewEdit1.DeleteUnusedStyles(True, True, True);
RichViewEdit1.LoadHTMLFromStream(Stream, '', 1200 {UTF-16});
RichViewEdit1.Format;
Stream.Free;