I have a Richedit that allows my users to format and view error messages that display within my application.
I now need to be able to export the text only (no formatting) out to another database that their trouble-ticket system uses.
I have tried all the combinations of PlainText I can think of and I always still get the rtf formatting.
How can I get the text only?
To obtain the unformatted text, simply use RichEdit1.Text
.
Answering the direct question that you asked, the Text
property is precisely what you are looking for. For some reason it doesn't show up in the TRichEdit
documentation, but it is inherited from TCustomEdit
.
It sounds to me (following comments to Andreas' answer) as though what you really need to do it as follows:
RichEdit.LoadFromStream
passing that stream, making sure PlainText
is False
.RichEdit.Text
to get the unformatted text.At the moment you are simply putting the RTF into the control as plain text. You need to put it into the control as rich text, and for that you need LoadFromStream
.
i use this way to get unformatted text
procedure TMainForm.O1Click(Sender: TObject);
begin
if sOpenDialog1.Execute then
sRichEdit1.Lines.LoadFromFile(sOpenDialog1.FileName);
sMemo1.Text := sRichEdit1.Text;
sRichEdit1.Clear;
sRichEdit1.Text := sMemo1.Text;
for save file you have to choices save as .txt the text still in memo but all change you made will be in richedit only so you have to move text to memo after done all your changes then save it from memo
save as .rtf just save it from richedit I hope thats help you
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With