Search Locate Previous Next Contents

How to Save a Report on File

This topic applies to all NewLeaf documents, tabular or otherwise. The final output of NewLeaf is a series of ASCII page descriptions held in text vector format. While you continue to add text, tables, etc., to a document, NewLeaf saves each page to an APL component file as it is completed. This file is created by default in the TEMP directory (typically c:\temp or c:\windows\temp) and has the name newleaf.spl.

Over-riding the spool path
To choose your own path for the spool file, assign global nl‘spoolpath to the directory where the spool files are to be stored:

nl‘spoolpath„'E:\reports'

This may be necessary if you only have write access to a particular set of network directories.

Over-riding the spool file name
If you have several copies of APL running NewLeaf at the same time on the same computer (possibly in a server environment) you will need to ensure that each instance uses a different file name for spooling. The application may set the spool file name, which is stored as a global nl‘spoolname:

nl‘spoolname„'spool23.spl'
nl‘spoolname„''  © name will be generated

If you set this to null (as in the lower example) NewLeaf will make a file name of the form ‘~1234567.spl’ from the system clock at the time you call nlUse. This will give every spool file a unique name, but you will need to track and later delete these yourself.

The file tie number is the value of nlspool; so if you must untie all component files while producing a report, do so using ŒFUNTIE ŒFNUMS~leaf.spool. To this point, you have used nlClose to terminate each report. This has the effect of reading the component file and concatenating all of the page descriptions into a single text vector which is returned as the result. The component file is erased, so:

nlInit ª nlUse''
nltTitles districts
nltList sales[1;;]
nlNewPage
nltList sales[2;;]
View doc„nlClose

leaves the entire document description in the variable doc. It is frequently useful to leave the document on file. This is done by terminating it with nlSpool which unties the file and returns its name. This allows you to rename the file and keep it for later viewing:

nlInit ª nlUse''
nltTitles districts
nltList sales[1;;]
nlNewPage
nltList sales[2;;]
docfile„nlSpool 'C:\SALESREPS\96H1.rep'
View 'C:\SALESREPS\96H1.rep'

If you run nlSpool with a null right argument, it returns the default file name (e.g. c:\temp\newleaf.spl) and simply unties the file.



Continue to: How to Create Adobe PDFs
© Copyright Causeway Graphical Systems Ltd 2001