Search Locate Previous Next Contents

How to Add Headers and Footers

Most reports have recurring elements which ‘top and tail’ the page. In the thumbnail we have a company name (printed in a bold font), some kind of logo, and a page number at the foot. The body of the report will fit in the frame which occupies the rest of the page.

A page such as this can easily be set up by hand, but a better way might be to use the NewLeaf page-design tool to lay out the elements visually:

plDesign 'mypage'   © Create a new layout

When you exit the Designer, you will find a variable mypage in your workspace which defines your design. This is a 5-column table, where the first 4 columns are standard for all NewLeaf objects: type; id or caption; position; size. Column-5 lists any other relevant properties, for example the font for the fixed text used to place the word ‘Company’ or the scan resolution used to make the bitmap for the logo.

To try out your report, simply ...

nlUse mypage   © Note that no quotes are needed here

and flow some text into the frame ...

nlFlow 'This is a really interesting report ...' 'and so on'

Finally psView nlClose to see how it looks.

You can modify the elements of the page definition by hand from APL (for example to change the page number to show ‘Page nn’) or you can simply redesign the form by calling plDesign again.



Continue to: How to Make an Intelligent Function Lister
© Copyright Causeway Graphical Systems Ltd 2001