Load RTF

General TRichView support forum. Please post your questions here
Post Reply
bswift
Posts: 37
Joined: Thu Sep 15, 2005 8:26 pm

Load RTF

Post by bswift »

I am using this

Code: Select all


RichViewEdit1.LoadRTF(s);

s being the path to the rtf file to be loaded.

All works well except it adds a blank line at the top of the inserted file.
Any help on this?

Thanks

bswift
Michel
Posts: 92
Joined: Fri Oct 14, 2005 2:56 pm
Contact:

Post by Michel »

Copy-and-paste from Help on TCustomRichView.LoadRTF:
Appends contents of RTF (Rich Text Format) file FileName to the document.
If you need to replace current contents with the contents of this file, call Clear method before loading.

Maybe this is all you need?

A note: an empty RichView[Edit] always contains one empty item (an so do table cells). This is likely what you see as a "blank line".

You can also try experimenting with TCustomRichViewEdit.InsertRTFFromFileEd() - the editing-style method.

Michel
Yernar Shambayev
Posts: 57
Joined: Wed Aug 31, 2005 6:46 pm

Re: Load RTF

Post by Yernar Shambayev »

bswift wrote:I am using this

Code: Select all


RichViewEdit1.LoadRTF(s);


RichViewEdit1.Clear;
RichViewEdit1.LoadRTF(s);
RichViewEdit1.Format;
bswift
Posts: 37
Joined: Thu Sep 15, 2005 8:26 pm

Load RTF

Post by bswift »

Yes, I understand about using the clear method. My problem is that I am appending to an existing file already loaded into the editor. I am trying to add a pagebreak before appending the file. This is where I end up with the extra item.

Bruce
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

LoadRTF must not add empty line.
But initially, each editor contains one empty line, so calling LoadRTF without Clear will result empty line + RTF doc.
rvanmaaren
Posts: 3
Joined: Thu Dec 02, 2010 11:31 am

Post by rvanmaaren »

Sorry to bring this topic up but in my situation did not resolve the issue on the empty line.

Code used :

Code: Select all


begin

  DeDocNaam := Copy(Impp.PaymentNotificationReportEKRTF.OutFile, 1, Length(Impp.PaymentNotificationReportEKRTF.OutFile));
  RichViewForm.RichViewModule.Visible := false;

   RichViewForm.RichViewModule.RichViewAll.LoadRTF(DeDocNaam);
  RichViewForm.RichViewModule.RichViewAll.Format;
 // RichViewForm.RichViewModule.RVReportHelperall.RichView.Clear;
  RichViewForm.RichViewModule.RVReportHelperall.RichView.LoadRTF(DeDocNaam);
  if Not(Impp.Payments.recno = Impp.Payments.recordcount) then

  begin
   // RichViewForm.RichViewModule.RichViewAll
    RichViewForm.RichViewModule.RichViewAll.PageBreaksBeforeItems[RichViewForm.RichViewModule.RichViewAll.ItemCount-1 ] := true;
    RichViewForm.RichViewModule.RVReportHelperall.RichView.PageBreaksBeforeItems[RichViewForm.RichViewModule.RichViewAll.ItemCount-1] := true;
  end;
  RichViewForm.RichViewModule.Visible := false;
  // ReplaceStringList.Destroy;
end;
Please suggest !

Regards,

Richard
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Call Clear before the first call of LoadRTF.
rvanmaaren
Posts: 3
Joined: Thu Dec 02, 2010 11:31 am

Post by rvanmaaren »

Hi,

This still does not solve this issue.

First page is ok but the pages after it get shifted by one line.
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Please send me a sample project to reproduce this problem.
rvanmaaren
Posts: 3
Joined: Thu Dec 02, 2010 11:31 am

Post by rvanmaaren »

Can be downloaded from http://www.van-maaren.nl/Example.zip [/url]
Post Reply