Structuring a Page in Page Mode
Page-based files
In addition to the continuous stream mode of operation of the PUT
statement discussed in the previous section, AIMMS also provides a
page-based file format. AIMMS divides a page-based file into pages of a
specified length, each consisting of a header, a body, and a footer.
Fig. 13 gives an overview of a page in a
page-based report.
Switching to page mode
You can switch between page and stream by setting the .PageMode
suffix of a file identifier to 'on'
or 'off'
(the elements of
the predefined set OnOff
), respectively, as in the statement
ResultFile.PageMode := 'on'
. The value of the .PageMode suffix
is 'off'
by default. When switching to another mode AIMMS will begin
with a new page or close the last page.
Page size and width
The default page size is 60 lines. You can overwrite this default by
setting the .PageSize suffix of the file identifier to another
positive integer value. For instance, ResultFile.PageSize := 10
will
give short pages with only ten lines per page. The default page width is
132 columns. You can change this default by setting the .PageWidth
suffix of the file identifier.
Headers and footers
The header and footer of a document can be specified by using the
PUTHD
and PUTFT
statements. They are equivalent to the PUT
statement but write in the header and footer area instead of in the page
body. The size of the header and footer is not preset, but is determined
by the contents of the PUTHD
and PUTFT
statements. The header
and footer keep their contents from page to page.
Margins
There are no specific attributes for either the top, bottom, left or
right margins of a page. You essentially control these margins by either
resizing the header or footer of a page, or by positioning the PUT
items in a starting column of your choice using the @
operator of
the PUT
statement.
Page structure
this table summarizes the file attributes for structuring pages. With the exception of the page body size (read only) you can modify their defaults by using assignment statements.
Suffix |
Description |
Default |
---|---|---|
Mode |
|
|
Page size |
60 |
|
Page width |
132 |
|
Current page number |
1 |
|
Body current column |
||
Body current row |
||
Body size |
||
Header current column |
||
Header current row |
||
Header size |
||
Footer current column |
||
Footer current row |
||
Footer size |
Positioning in page mode
The positioning operators @
, #
, and /
explained in
The PUT Statement are also applicable in page mode. However, AIMMS
offers you additional file attributes for positioning items in a
page-based file.
Current row and column
Whenever you PUT
an item into a header, footer, or page body, there
is a current row and a current column. AIMMS keeps track of which row
and column are current through the suffices .BodyCurrentRow and
.BodyCurrentColumn of the File
identifier. You can either read
or overwrite these values using assignment statements. Similar suffices
also exist for the header and the footer area.
Modifying size of page sections
After having specified the header, footer, or page body, you may want to change their size at some stage during the process of writing pages. By specifying the .BodySize, .HeaderSize and .FooterSize suffices you can modify the size (or empty) the page body, the header, or the footer. The value of the .BodySize suffix can be at most the value of the .PageSize suffix minus the value of the .HeaderSize and .FooterSize suffices.
Printing the page number
Whenever you write the contents of the .PageNumber suffix of a
File
identifier in its header or the footer area, AIMMS will replace
it with the current page number whenever it prints a page of a page
based report. By default, the first page will be numbered 1, but you can
override this by assigning another value to the .PageNumber suffix.