A simple footer on all pages in a TRichview report

General TRichView support forum. Please post your questions here
Post Reply
pbarrettx1
Posts: 9
Joined: Mon May 05, 2008 12:28 am
Location: Auckland (NZ)
Contact:

A simple footer on all pages in a TRichview report

Post by pbarrettx1 »

I'm assuming this is just not possible in Richview.

I've created a report (lbox), which uses the Richview component - everything is fine.

Before I save it to RTF, I want to put a simple text footer, right justified, on the page. A border line just bove the test might also be nice but is optional; I'll settle for anything!

I've looked at every demo example, comment, other solutions I could find .. but most seem completely unintelligable (given the sheer simplicity of what I need)!

I was assuming a likely command as straightforward as:
lbox.footer('text', para format, textstyle)
existed ..

I've tried using RVPrint but there is no option to include footer text as a simple text string (i.e. as a caption or footer text field).

I've managed to isolate the RTF code to put a footer with a line into an RTF stream - but then there is no way of inserting this code into the RTF file unless I save it first (SaveToRTF), then re-open it, read it as a textfile, filter the text for a specific 1st instance or '/pard' (to make the insert at a suitable place) and resave it.

So, before I have to program the RTF insertion routine myself, I'm hoping there is a simpler way I can just add the text via Richview.

Thanks .. Paul
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Plain text headers are not supported, but you can assign another document as a header.

Example can be found in the demo
Demos\DelphiUnicode\Assorted\Printing\Headers\
pbarrettx1
Posts: 9
Joined: Mon May 05, 2008 12:28 am
Location: Auckland (NZ)
Contact:

Post by pbarrettx1 »

Ah, thanks Sergey

That explains why I could'nt figure out the sheer volume of commands used to put the footer onto a page!

I'll see what I can do.

Thanks .. Paul
pbarrettx1
Posts: 9
Joined: Mon May 05, 2008 12:28 am
Location: Auckland (NZ)
Contact:

Post by pbarrettx1 »

This is really annoying.

I inserted a footer into an RTF document save by Richview (with suitable RTF code).

I can load the RTF document in Word 2013 and the footnote is perfect.

However, no footer is displayed when loading the same document in Richview.

I'm assuming Richview really is blind to raw RTF code specifying a footer (i.e. it does not interpret footer code as does MS Word). Can you confirm?

The problem I'm having is that I'm using Gnostice's edocengine to convert my RTF to PDF, using their Richview interface. I need a footer in the pdf file, not in a print preview etc.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

TRichView can save and load headers and footers from RTF.
To do it, call RichViewEdit1.RTFReadProperties.SetHeader/SetFooter to assign header/footer, and include rvrtfSaveHeaderFooter in RichViewEdit1.RTFOptions.
You can see how it is done in the demo Demos\DelphiUnicode\Assorted\Printing\Headers\
If it does not work in your tests, create a simple project and send to richviewgmailcom, I'll tell how to modify it.
pbarrettx1
Posts: 9
Joined: Mon May 05, 2008 12:28 am
Location: Auckland (NZ)
Contact:

Post by pbarrettx1 »

Thanks Sergey

I was playing with the Headers demo program yesterday - and noted that your program did automaticaly pick up my 'manually inserted' footer in the RTF file as a footer.

I could print the file with footer using RVPrint without any problems.

What I couldn't figure out was how to load the file including its footer (as an RTF) into RVReportHelper in order to be able to submit the file for conversion to pdf via Gnostice's edocengine, using their command (gtRichViewInterface1.RenderDocument(RVReportHelper1);

Let me work with your suggestions to see if I can crack this.

Thanks .. Paul
pbarrettx1
Posts: 9
Joined: Mon May 05, 2008 12:28 am
Location: Auckland (NZ)
Contact:

Post by pbarrettx1 »

Hmm .. the problem is very clear now ..

Working with your Headers demo, I can see exactly what you are doing ...

The problem really does come down to how to 'insert' the file with its header into RVReportHelper, so that I can fire up the pdfengine command:

e.g.
gtPDFEngine1.FileName := 'test.pdf';
RVReportHelper1.RichView.LoadRTF('footer-doc.rtf');
Prepareprinting; {your routine in the Headers demo program - header detected}

RVPrint1.Print('c:\temp\rvprintdoc', 1, false);
{yes, this works fine - it prints - but that's not what I need}

RVPrint1.AssignSource(RVReportHelper1.RichView);
gtRichViewInterface1.RenderDocument(RVReportHelper1);
{This just prints the document with no header}

I'm stumped. I must be missing something somewhere in connection with loading a document with its footer into RVReportHelper.

Regards .. Paul
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I am sorry for the delay.

TRVReportHelper does not support printing headers and footers. Only TRVPrint can do it.
AFAIK, eDocEngine can create PDF both from TRVReportHelper and from TRVPrint.

TRVReportHelper is intended to draw/print in the specified rectangular area. Using it, you can implement headers and footers manually, see http://www.trichview.com/forums/viewtopic.php?t=327
But for PDF generation with eDocEngine, you will need to modify code of gtRichViewInterface.
pbarrettx1
Posts: 9
Joined: Mon May 05, 2008 12:28 am
Location: Auckland (NZ)
Contact:

Post by pbarrettx1 »

Thanks Sergey

Many thanks for the reply.

In the end I went for a 'computed' footer (counting lines used per page, using a suitable bottom margin, and the insertion of a footer line on the last possible line before a new page is triggered). Not pretty but does the job!

Regards .. Paul
Post Reply