Adobe framemaker 6.0 Manuale Utente

Pagina di 323
247
ADOBE FRAMEMAKER 6.0
 Examples
3
When the document has the appearance you want, save it as a MIF file.
4
Edit the MIF file to create a MIF template that you can include in your generated MIF file (see “Including 
template files” on page 55). The MIF template used for this example is in the sample file coffee.mif.
5
Use your database to create any custom dialog boxes or report-generating procedures.
6
Create a database query, or procedure, that extracts data from the database and writes it out into a MIF 
file. Use a MIF include statement to include the document template in the new document.
The database user can now open a fully formatted report.
The code for the procedure that extracts information from the database and outputs the MIF strings is 
shown in this appendix. This procedure is written in the ACIUS 4th DIMENSION command language. 
You could use any database query language to perform the same task. 
The procedure does the following:
7
Creates a new document.
8
Sends the MIFFile identification line.
9
Uses include to read in the formatting information stored in the template coffee.mif.
10
Sends the MIF statements to create a table instance. 
11
In each body cell, sends a field that includes the information extracted from the database.
12
Creates a text flow that uses the TextRectID from the empty body page in the coffee.mif template.
13
Includes the Atbl statement that places the table instance in the document text flow.
14
Closes the document.
In the following example, database commands are shown like this: 
SEND PACKET
. Comments are 
preceded by a single back quote (`). Local variables are preceded by a dollar sign ($).
`This procedure first gets the information entered by the user and stores it 
in local variables:
   `   $1 = Name of sales representative
   `   $2 = Phone  number
   `   $3 = Discount
CR:=char(13) ` carriage return character
DQ:=char(34) ` double quotation mark character
C_TIME(vDoc)
CLOSE DOCUMENT(vDoc)
vDoc:=Create document("")
vDisc:=1-(Num($3»)/100)
   `Send  header.
SEND PACKET(vDoc;"<MIFFile 6.00> #Generated by  4th Dimension  for 
Version 6.0 of FrameMaker"+CR)
   `Read in the MIF template  for the report.
SEND PACKET(vDoc;"include (coffee.mif)"+CR)
   `Generate table.
SEND PACKET(vDoc;"<Tbls <Tbl <TblID 2> <TblFormat <TblTag `Format 
A'>>"+CR)