...draw page numbers, headers and footers
|Top Previous Next|
Complex headers and footers, the same for all pages
The component supports complex headers and footers, they can be multiline, contain images, tables, etc.
See the example:
There is a limitation of this method: the same header and footer for all pages, with no dynamic fields (like page number).
Drawing headers and footers yourself
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:
Since you draw this text yourself, you can draw as many lines as you want.
RichViewActions process this event themselves and draw one plain text line. They understand several codes like page number and pages count.
Drawing complex headers and footers using TRVReportHelper
If you need to draw more complex headers (different for different pages), you can use TRVReportHelper component for this:
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.
It is is shown in this demo:
http://www.trichview.com/support/files/cppheader.zip (for C++Builder).
The next demo uses TRVReportHelper for drawing both header/footer and the main document:
http://www.trichview.com/support/files/a4.zip (for Delphi)
It draws the result on the metafile, but can be easily changed to draw on the printer canvas.
The most complex case:
▪headers are complex documents;
▪headers have different heights on different pages.
New information on this topic will be posted here: http://www.trichview.com/forums/viewtopic.php?t=327
TRichView © trichview.com