Page 1 of 1

Load RTF

Posted: Thu Feb 23, 2006 10:41 pm
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

Posted: Fri Feb 24, 2006 2:41 pm
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

Re: Load RTF

Posted: Fri Feb 24, 2006 4:03 pm
by Yernar Shambayev
bswift wrote:I am using this

Code: Select all


RichViewEdit1.LoadRTF(s);


RichViewEdit1.Clear;
RichViewEdit1.LoadRTF(s);
RichViewEdit1.Format;

Load RTF

Posted: Fri Feb 24, 2006 5:42 pm
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

Posted: Sun Feb 26, 2006 10:07 am
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.

Posted: Thu Dec 02, 2010 11:34 am
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

Posted: Thu Dec 02, 2010 12:55 pm
by Sergey Tkachenko
Call Clear before the first call of LoadRTF.

Posted: Wed Feb 02, 2011 8:50 am
by rvanmaaren
Hi,

This still does not solve this issue.

First page is ok but the pages after it get shifted by one line.

Posted: Wed Feb 02, 2011 10:23 am
by Sergey Tkachenko
Please send me a sample project to reproduce this problem.

Posted: Thu Feb 03, 2011 8:47 am
by rvanmaaren
Can be downloaded from http://www.van-maaren.nl/Example.zip [/url]