Mega Code Archive

 
Categories / Delphi / Examples
 

Getrtfcodes

> I need to get a string with rtf codes by programmation. When I try the > lines.text attribute, it just return plain text. > Frédéric, something like this: Var richtext:String; ms: TMemoryStream; Begin ms:= TMemoryStream.Create; try with richedit1 do begin plaintext := false; Lines.Savetostream(ms); ms.Position := 0; SetLength( richtext, ms.Size ); ms.Read( richtext[1], ms.Size ); end; finally ms.free; end; End; If you need to get the current selection as rich text, go to www.dejanews.com and search for "GetRTFSelection AND EM_STREAMOUT". Peter Below (TeamB) 100113.1101@compuserve.com) No e-mail responses, please, unless explicitely requested!