Recent

Author Topic: [solved] RichMemo - How to safe it into a file?  (Read 534 times)

Nicole

  • Sr. Member
  • ****
  • Posts: 478
[solved] RichMemo - How to safe it into a file?
« 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?
« Last Edit: July 14, 2022, 06:02:22 pm by Nicole »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2763
    • havefunsoft.com
Re: RichMemo - How to safe it into a file?
« Reply #1 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
« Last Edit: July 11, 2022, 08:48:04 pm by skalogryz »

Nicole

  • Sr. Member
  • ****
  • Posts: 478
Re: RichMemo - How to safe it into a file?
« Reply #2 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')

rvk

  • Hero Member
  • *****
  • Posts: 5014
Re: RichMemo - How to safe it into a file?
« Reply #3 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()?


Nicole

  • Sr. Member
  • ****
  • Posts: 478
Re: RichMemo - How to safe it into a file?
« Reply #4 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.)
« Last Edit: July 12, 2022, 11:02:19 am by Nicole »

rvk

  • Hero Member
  • *****
  • Posts: 5014
Re: RichMemo - How to safe it into a file?
« Reply #5 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.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2763
    • havefunsoft.com
Re: RichMemo - How to safe it into a file?
« Reply #6 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!

Nicole

  • Sr. Member
  • ****
  • Posts: 478
Re: RichMemo - How to safe it into a file?
« Reply #7 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