|
...draw page numbers, headers and footers |
Top Previous Next |
Complex headers and footers, the same for all pagesThe 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\ ▪Demos\CBuilder\Assorted\Printing\Printing\ 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 yourselfIf 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\ ▪Demos\CBuilder\Assorted\Printing\Printing\ 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 TRVReportHelperIf 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 (for Delphi) 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. http://www.trichview.com/support/files/printheaderex.zip (for Delphi) Online updatesNew information on this topic will be posted here: http://www.trichview.com/forums/viewtopic.php?t=327 |