Recent

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

bigeno

  • Full Member
  • ***
  • Posts: 214
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

  • Full Member
  • ***
  • Posts: 214
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;