RTF not saving DocParameters.Comments

General TRichView support forum. Please post your questions here
Post Reply
standay
Posts: 274
Joined: Fri Jun 18, 2021 3:07 pm

RTF not saving DocParameters.Comments

Post by standay »

Using trial version 19.2. I have both RTF and RVF set to save and load DocParameters in their respective options.

Problem: I have a test RTF file. When I save it, I'm doing this:

RichViewEdit1.DocParameters.Comments := Memo1.Text;
RichViewEdit1.SaveRTF(ExtractFilePath(Application.ExeName) + 'test.rtf',false);
RichViewEdit1.DocParameters.Comments := '';

When I load it, I do this:

RichViewEdit1.ClearAll;
RichViewEdit1.DeleteUnusedStyles(true,true,true);
RichViewEdit1.LoadRTF(ExtractFilePath(Application.ExeName) + 'test.rtf');
Memo1.Text := RichViewEdit1.DocParameters.Comments;

DocParameters.Comments are always empty after saving RTF from my test app. If I check the file in Word after saving it from my test app, it also shows Comments as empty. If, however, I add a comment to the test file in Word, and then load it in my test app, the comment shows up. But if I save from my app again the comment is wiped out.

RVF is working as expected with the same basic code.

Any ideas on what is wrong? Thanks!
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: RTF not saving DocParameters.Comments

Post by Sergey Tkachenko »

Assign
RichViewEdit1.RTFReadProperties.ReadDocParameters := True;
standay
Posts: 274
Joined: Fri Jun 18, 2021 3:07 pm

Re: RTF not saving DocParameters.Comments

Post by standay »

Sergey Tkachenko wrote: Wed Jul 07, 2021 9:31 am Assign
RichViewEdit1.RTFReadProperties.ReadDocParameters := True;
Yes, it is already set that way. Both that and rvrtfSaveDocParameters are set to true.

Reading a file with a comment in it works. So, if I open my test.rtf in Word, add a comment and save it, then open it in the RichViewEdit in my app, I do see the comment, but only if I added the comment using Word.

Saving it from the RichViewEdit does not work. If I add a comment when I save the test.rtf from my app, the comment is empty afterward. It's the saving a comment part of it that is not working for me. It does work in RVF format, but not rtf. When saving the rtf I'm using:

Code: Select all

RichViewEdit1.DocParameters.Comments := Memo1.Text; //memo1 has text in it
RichViewEdit1.SaveRTF(ExtractFilePath(Application.ExeName) + 'test.rtf',false);
RichViewEdit1.DocParameters.Comments := '';
The comment is never saved. If I open the file in Word, add a comment there and save, it is in there. Just not when saving from the RichViewEdit in my app.

Hope that helps.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: RTF not saving DocParameters.Comments

Post by Sergey Tkachenko »

I confirm the bug: Author, Title, and Comments are saved in RTF correctly only if they contain non-English characters.
I fixed it in my working version, this fix will be included in the next update.
standay
Posts: 274
Joined: Fri Jun 18, 2021 3:07 pm

Re: RTF not saving DocParameters.Comments

Post by standay »

Sergey Tkachenko wrote: Thu Jul 08, 2021 4:01 pm I confirm the bug: Author, Title, and Comments are saved in RTF correctly only if they contain non-English characters.
I fixed it in my working version, this fix will be included in the next update.
Thanks Sergey.
Post Reply