trichview.com Forum Index trichview.com
TRichView support forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Demos] Headers and Footers

 
Post new topic   Reply to topic    trichview.com Forum Index -> Examples, Demos
View previous topic :: View next topic  
Author Message
Sergey Tkachenko
Site Admin


Joined: 27 Aug 2005
Posts: 6576

PostPosted: Wed Nov 09, 2005 5:19 pm    Post subject: [Demos] Headers and Footers Reply with quote

Quote:
Question Hi, Is it possible with TRichView 1.9.8 to include Page Header and PageFooter?
And how?


Yes and no.

It's possible to make any kind of header and footer, but they must be implemented differently depending on your needs.

The component supports complex headers and footers - they can be multiline, contain images, tables, etc.
They must be assigned to TRVPrint component by the methods SetHeader and SetFooter.
See the example Demos\Delphi\Assorted\Printing\Headers\
There is a limitation of this method - the same header and footer for all pages, with no dynamic fields (like page number).

If you need different headers for different pages, you need to draw them yourself, using OnPagePrepaint event.
This demo shows how to draw a simple text as a header:
Demos\Delphi\Assorted\Printing\Printing\
Since you draw this text yourself, you can draw as many lines as you want.

RichViewActions ( http://www.trichview.com/resources/actions/ ) process this event themselves and draw one plain text line. But they are limited with one line. They understand several codes like page number and pages count.

If you need to draw more complex headers (different for different pages),
you can use TRVReportHelper component for this:
http://www.trichview.com/support/files/printheader.zip
This demo uses TRVReportHelper to draw header in TRVPrint.OnPagePrepaint event.
This demo draws the same header for all pages, but can be easily changed to draw different ones.

How it can be done is shown in this demo
http://www.trichview.com/support/files/cppheader.zip , but it's for
C++Builder.

And the last demo - using TRVReportHelper for drawing both header/footer and the main document:
http://www.trichview.com/support/files/a4.zip
It draws the result on the metafile, but can be easily changed to draw on
the printer canvas.
Back to top
View user's profile Send private message Visit poster's website
Sergey Tkachenko
Site Admin


Joined: 27 Aug 2005
Posts: 6576

PostPosted: Sat Sep 09, 2006 11:47 am    Post subject: Reply with quote

The most complex case:
- headers are complex documents;
- headers have different heights on different pages.
http://www.trichview.com/support/files/printheaderex.zip

This demo is updated 2007-May-24. Fix: when drawing preview, printer-compatible Canvas must be used for calling rvhHeader.Init (instead of the print preview window Canvas)
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    trichview.com Forum Index -> Examples, Demos All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group