trichview.support
Re: Nonvisual convert HTML to RTF |
Author |
Message |
Sergey Tkachenko |
Posted: 10/14/2003 9:31:41 In the current version, TRichViewEdit must have assigned parent. frm := TForm.Create(nil); {!!!} rve := TRichViewEdit.Create(nil); rve.Parent := frm; {!!!} style := TRVStyle.Create(nil); rve.Style := style; try importer := TrvHTMLImporter.Create(nil); try importer.RichView := rve; importer.LoadHtml(HTMLText); finally importer.Free; end; rtfStream := TStringStream.Create(''); try rve.SaveRTFToStream(rtfStream, False); result.Text := rtfStream.DataString; finally rtfStream.Free; end; finally style.Free; rve.Free; frm.Free; {!!!} end; > I need to take some html from a received email and convert it to rtf to save > in my database, but this needs to be done non-visually. I'm trying the > below, but I get an "EInvalidOperation - 'Control' has no parent window" > error. Any suggestions? > > rve := TRichViewEdit.Create(nil); > style := TRVStyle.Create(nil); > rve.Style := style; > try > importer := TrvHTMLImporter.Create(nil); > try > importer.RichView := rve; > importer.LoadHtml(HTMLText); > finally > importer.Free; > end; > rtfStream := TStringStream.Create(''); > try > rve.SaveRTFToStream(rtfStream, False); > result.Text := rtfStream.DataString; > finally > rtfStream.Free; > end; > finally > style.Free; > rve.Free; > end; > > |
Powered by ABC Amber Outlook Express Converter