Save Header in RTF

General TRichView support forum. Please post your questions here
Post Reply
janavida
Posts: 7
Joined: Tue Sep 09, 2008 2:53 pm

Save Header in RTF

Post by janavida »

Hello,
I will save Header in RTF. For that I have activated the rtfoption rvrtfSaveHeaderFooter. But now I get an error 'Error at reading from rve.RTFOptions'
Sergey Tkachenko
Site Admin
Posts: 17571
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I think you have 2 versions of TRichView files in different directories.
A newer version is installed in Dephi, but applications are still compiled with older version.
Find files of older version and delete them.
janavida
Posts: 7
Joined: Tue Sep 09, 2008 2:53 pm

Post by janavida »

Thank you!! That was it.
Now I'm trying to save header like this:

Code: Select all

  rveHeader.clear;
  rveHeader.InsertText('test');
  rveHeader.Format;

  rve.Clear;
  rve.RTFReadProperties.SetHeader(rveHeader.RVData);
  rve.FORMAT;
  rve.SaveRTF(rtfcomplete,FALSE);
But there will be no Header in the RTF document.. I can't find a solution somewhere in the forum.
Sergey Tkachenko
Site Admin
Posts: 17571
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Your code must save RTF with header if rvrtfSaveHeaderFooter is included in rve.RTFOptions.
If not, please send me a project reproducing this problem.
janavida
Posts: 7
Joined: Tue Sep 09, 2008 2:53 pm

Post by janavida »

Thanks for your fast answers!!
Now I tried this without any code around it - then it works!
But it doesn't solved my problem.
I am saving the RTF. When I open it with word I can see the Header. Then I open it again with RichViewPDF

Code: Select all

RichViewPDF.TopMargin:=0;
RichViewPDF.LeftMargin:=0;
RichViewPDF.RichView.LoadRTF('c:\Programme\idssdb\temp\text.rtf';
and then save it to PDF

Code: Select all

RichViewPDF.SaveToPDFFile(datverzeichnis + 'SDB.pdf'); 

I have to set TopMargin and LeftMargin to 0 because I have borders around text. When I don't set it to 0 the borders are on top and the text on the right place.
There is no Header in PDF.

But now I don't know what to do to have a topmargin..
My idea was, to save an empty Header. But it didn't work.
Do you have an idea?
Sergey Tkachenko
Site Admin
Posts: 17571
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

First, what version of MS Word do you use? MS Word 2007 saves headers differently, and the current version of TRichView cannot read them yet.

Next, what is RichViewPDF?
janavida
Posts: 7
Joined: Tue Sep 09, 2008 2:53 pm

Post by janavida »

I'm using Word2003.
RichViewPDF is the RolePDF from Roledata. I think its a problem of this program. So im looking for another solution.
Sergey Tkachenko
Site Admin
Posts: 17571
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

RichViewPDF does not support headers and footers.
You can look in its source code, in TRichViewPDF.SaveToPDFFile.
It outputs only content of RichView property (by copying it via RTF stream in TRVReportHelper component).

I suggest instead of using this component, use TRolePDF component directly. It provides Canvas where you can draw what you want, including header and footer. You can create your procedure basing on TRichViewPDF.SaveToPDFFile and code from http://www.trichview.com/forums/viewtopic.php?t=2511

If you need help, I'll try to create an example.
janavida
Posts: 7
Joined: Tue Sep 09, 2008 2:53 pm

Post by janavida »

It would be nice if you could give me a small example. Thanks! :-)
Post Reply