Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Font Size, Type and etc. while printing the document

Status
Not open for further replies.

AhmetSinav

IS-IT--Management
Mar 28, 2006
25
0
0
TR
OpenEdge 10.1B.
Hi,
i can change font via the following code,
PROCEDURE runPrintTest:
OUTPUT TO printer.
MESSAGE "This is a test".
OUTPUT CLOSE.
END PROCEDURE.
RUN runPrintTest.

LOAD "SOFTWARE\PSC\PROGRESS\10.1B\" BASE-KEY "HKEY_CURRENT_USER".
/* Set PrinterFont */
PUT-KEY-VALUE SECTION "Startup" KEY "PrinterFont" VALUE "Courier New, size=8, bold".
USE "SOFTWARE\PSC\PROGRESS\10.1B\".

/* Use new PrinterFont setting */
RUN runPrintTest.

i want to set more fonts to my document. for example i want to make the headers bold and the data's is not bold.
/* headers */
Customer No Customer Name /* this font will be Bold */
/* datas */
1 blalalala /* this font will be Normal */
Best Regards.
 
First, determine the control codes which your printer understands. HP and compatible printers use PCL, your mileage may vary.

Then use the 'PUT CONTROL' statement within your procedure to output the control codes and set font characteristics as desired. You may do other formatting with PCL, such as landscape orientation, registration adjustment to fit pre-printed forms, and so forth.

For your specific example of bold headers and normal body text, you will probably want to use the PUT statement for both headers and data, as opposed to DISPLAY which automatically generates the column headers by default.
 
Hi;
Thanks for your answer. Can u send me an example about this?
Best Regards.
 
Step 0 is the PCL code. Here is a PCL reference page:

If your printer does not understand PCL, you will need to determine from your printer's documentation what codes to use.

Note the code for BOLD is 'Esc(s3B',
and the code for NORMAL is 'Esc(s0B'.

Since the 'ESC' (escape) character is non-printing, it must be generated with the CHR function. An ascii reference page, , shows that 'ESC' is equivalent to decimal 27.

Now we have enough information to build the control strings. Here is the code (I am printing to a HP Deskjet printer):

Code:
/* print control demo 04/28/06 */

/* define variables to hold the control codes */
DEF VAR v-bold AS CHARACTER.
DEF VAR v-normal AS CHARACTER.

/* set the control codes */
v-bold = CHR(27) + "(s3B".
v-normal = CHR(27) + "(s0B".

OUTPUT TO PRINTER.

PUT CONTROL v-bold.

PUT "This is BOLD print." SKIP.

PUT CONTROL v-normal.

PUT "This is normal print." SKIP.

OUTPUT CLOSE.

When using PUT in this manner for a formal report, you will need to take explicit control of all aspects of your printed output, i.e. use the LINE-COUNTER function to determine when page-breaks are appropriate, use the PAGE statement to insert those page breaks, and construct and PUT your own page and column headers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top