Recent

Author Topic: Convert to plain text  (Read 4634 times)

bigeno

  • Sr. Member
  • ****
  • Posts: 266
Convert to plain text
« on: December 06, 2017, 08:41:44 am »
I've problem with convert rtf to text from Richmemo.
I just try to create richmemo load rtf and get text but maybe its wrong.
Code: Pascal  [Select][+][-]
  1.  debugln('rtf source='+s);
  2.  Rich := TRichMemo.Create(nil);
  3.  try
  4.     Rich.Rtf:=s;
  5.     Result:=Rich.Text;
  6.     debugln(Result);
  7.  finally
  8.     Rich.Free;
  9.  end;
I'm getting empty variable.
How can I do this ?

bigeno

  • Sr. Member
  • ****
  • Posts: 266
Re: Convert to plain text
« Reply #1 on: December 06, 2017, 09:14:04 am »
Ok, nvm,  I found the problem, TRichMemo need Parent assigned.
Code: Pascal  [Select][+][-]
  1.  Rich := TRichMemo.Create(nil);
  2.  Rich.Visible:=false;
  3.  Rich.Parent:=Form;  

 

TinyPortal © 2005-2018