admin 發表於 2016-6-10 11:31:35

Ascii Printing Codes <INFORMIX-4GL>

As most replies have already indicated, Informix doesn't make printing easy;
however, it's not all that difficult, either. You will need to do a little research, but if you have the necessary user manuals for the printers you want to use, setting up your printer codes is relatively easy. What you'll need to do is define some character-type variables to represent the printer codes you want to work with:
i.e.; bold on, underline on, underline off,landscape, portrait, etc.
Don't forget to include a variable for the reset codes as well, so you can return the printer to it's internally programmed default setup when your report is finished.
The size of each character variable will be dependent upon the number of characters required for each printer code used; again, per your printer's usual manual.
These are generally best defined in the report function, since they're not likely to
be used elsewhere in your program. Once the variables are assigned and the appropriate codes have been assigned,
simply sent the codes to the printer using the report function's 'print' statement, as they are required.


The following example is for an H-P LaserJet 4:


REPORT BALANCE_SHEET()
DEFINE l_bold_on char(05), { Bold on }
l_normal char(06), { Normal }
l_ul_on char(05), { Underline on }
l_ul_off char(04), { Underline off }
l_lscape char(05), { Landscape orientation }
l_reset char(02) { Printer reset }

FORMAT
PAGE HEADER
LET l_bold_on = ascii 027, ascii 040, ascii 115,ascii 051, ascii 066
LET l_normal = ascii 027, ascii 040, ascii 115,Ascii 045, ascii 051. ascii 066
LET l_ul_on = ascii 027, ascii 038, ascii 100,Ascii 048, ascii 069
LET l_ul_off = ascii 027, ascii 038, ascii 100,ascii 064
LET l_lscape = ascii 027, ascii 038, ascii 108,Ascii 049, ascii 079
LET l_reset = ascii 027, ascii 069
PRINT COLUMN 1, l_landscape, l_bold_on, l_ul_on,"COMPANY NAME", l_ul_off, l_normal
ON EVERY ROW
PRINT COLUMN... (report data)
ON LAST ROW
PRINT COLUMN 1, l_reset
END REPORT

頁: [1]
查看完整版本: Ascii Printing Codes <INFORMIX-4GL>