Lazarus

Programming => Packages and Libraries => RichMemo => Topic started by: Nicole on July 11, 2022, 08:23:28 pm

Title: [solved] RichMemo - How to safe it into a file?
Post by: Nicole on July 11, 2022, 08:23:28 pm
TRichEdit from Delpi knows "TRichEdit.SaveToFile('myFile');

and .LoadFromFile.

How to do this by Lazarus and RichMemo?
Title: Re: RichMemo - How to safe it into a file?
Post by: skalogryz on July 11, 2022, 08:46:31 pm
.LoadRichText
.SaveRichText

and it needs a TFileStream as a parameter

OR there RichMemoUtils unit with
LoadRTFFile and SaveRTFFile functions
Title: Re: RichMemo - How to safe it into a file?
Post by: Nicole on July 11, 2022, 08:59:07 pm
thank you for the answer.
Please can you do it one by one for stupid?

if there is a RichMemo1
and a
c:\myFile

How to connect them?

(I tried a lot, but ended up with error messages about strings, files and streams, filestreams and datastreams "no compatibel')
Title: Re: RichMemo - How to safe it into a file?
Post by: rvk on July 11, 2022, 09:35:31 pm
OR there RichMemoUtils unit with
LoadRTFFile and SaveRTFFile functions
Argh. I missed those in the other topic from TS.
I gave there a class helper for TRichMemo.LoadRTFFromFile.

(I tried a lot, but ended up with error messages about strings, files and streams, filestreams and datastreams "no compatibel')
Always show code and error messages.

Did you include RichMemoUtils in the uses and tried RichMemo1.LoadRTFFile()?

Title: Re: RichMemo - How to safe it into a file?
Post by: Nicole on July 12, 2022, 10:59:11 am
yes.

uses

  LazFileUtils,  RichMemoUtils,   VpData; 

================
code

   self.RichMemo_Notizen.LoadRTFFile(Pfad + 'RichMemo.txt');

============
 compiler

   unit_notizen.pas(153,26) Error: identifier idents no member "LoadRTFFile"   


(PS pls explain this to me, because I am not sure, how to do better: 'Argh. I missed those in the other topic from TS.
I gave there a class helper for TRichMemo.LoadRTFFromFile.' start explanaition by: What does TS mean? thx.)
Title: Re: RichMemo - How to safe it into a file?
Post by: rvk on July 12, 2022, 11:07:25 am
   self.RichMemo_Notizen.LoadRTFFile(Pfad + 'RichMemo.txt');
The LoadRTFFile from RichMemoUtils isn't implemented as class helper (like I did in the other topic) but as ordinary function.
(sorry for the confusion)

So you can just use
Code: Pascal  [Select][+][-]
  1. LoadRTFFile(Pfad + 'RichMemo.txt');

TS stands for Topic Starter (you  :D). Sometimes also OP (Original Poster) is used.
Title: Re: RichMemo - How to safe it into a file?
Post by: skalogryz on July 12, 2022, 08:17:50 pm
   unit_notizen.pas(153,26) Error: identifier idents no member "LoadRTFFile"   

Code: Pascal  [Select][+][-]
  1.   LoadRTFFile(self.RichMemo_Notizen, Pfad + 'RichMemo.txt');

Argh. I missed those in the other topic from TS.
I gave there a class helper for TRichMemo.LoadRTFFromFile.
thank you for your ongoing support for RichMemo.
I mean it!
Title: Re: RichMemo - How to safe it into a file?
Post by: Nicole on July 13, 2022, 10:20:44 am
Thank you so much!
Now my document loads. Everything there, each letter size, echt paragraph, each bold format  :D :D :D
TinyPortal © 2005-2018