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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I force fixed space fonts in printing

Status
Not open for further replies.

BobMorris

Programmer
Jul 6, 2001
32
0
0
US
I'm working on converting two ancient Fox DOS systems to VFP. Both have reports done in code, not in report form. I need a way to force these reports to print with fixed space fonts.

In Fox DOS, these reports print with the DOS fixed spaced fonts. However in Windows they print with variable spaced fonts - which messes up how the reports look as, for example, columns of numbers no longer line up.

Re-writing the reports in report form isn't an option. One system has 150 reports the other has, are you ready, over 3,000.

Any ideas on how to make these reports print in fixed space fonts?

Thanks!

Bob Morris
 
BobMorris

Have you tried using a monospaced font like "courrier"?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
1. If you have converted the reports to VFP format, you can hack the report header and set the font, by code.

2. You can also set in the report designer->Menu->Reports->default font->
and set the font for all reports.
Then open up the reports one by one and save it.

3. There is yer another way, using _pdsetup.

you can explore these before the convertion.

:)

ramani :)
(Subramanian.G)
 
Hi Bob,

My understanding of your post is that your reports are .prgs and you need them to stay like that.

Do the @...SAY or ? commands specify a font? If so I'd just do a massive search and replace, changing the fontname to something like Courier. If not, FoxPro is choosing a default font. There may be a way to change the default font, but I don't know it.

You could also write a little program which would add a fontname to all output statements, then run all your source code thru it. Backup first!

Jim
 
You can also use a Generic/Text only printer driver.
Another option (as Mike eluded to) with only a partial rewrite, would be to add a statement something like:

FONT 'Courier', 9

to the end of the @...SAY or ?? statements:

?? MyTable.MyField FONT 'Courier', 9
-or-
@ nRow, nCol SAY MyTable.MyField FONT 'Courier', 9 nRow = nRow + 1



-Dave S.-
[cheers]
Even more Fox stuff at:
 
Thanks to all for replies

> My understanding of your post is that your reports are .prgs and you need them to stay like that.

Yes, I do, at least for now, There are way too many report PRGs to convert them to report forms.

Adding FONT "Courier", 9 to the end of each @ say would work but would also be a large undertaking.

I finally kludged a solution.

1) Write the report to a txt file
2) Pop the txt file into a memo field
3) Print from the memo field

* rpt is the memo field
nLines = MEMLINES(rpt)

set print on
FOR i = 1 to nLines
cLine = MLINE( rpt, i )
? cLine FONT "Courier", 9
NEXT
set print off

That way the "Courier" 9 only goes at the end of one line.

Bob Morris
 
Looks like a good workaround.
Another kludge I have used is to create a report form with one detail line as long as the line in the report, whatever font. Print the report to an ascii file, then import the text file to a temp table and run the report form from that.

CREATE TABLE TempTable (cLine c(100))
REPORT FORM myreport TO FILE Tempfile.txt ASCII
SELECT TempTable
APPEND FROM Tempfile.txt
REPORT FORM myreport TO PRINT

That would allow you the flexibility to change the font, orientation, etc., as needed.


-Dave S.-
[cheers]
Even more Fox stuff at:
 
Printers typically operate using PCL (printer control language) commands. You can programmatically change the printer so it prints a specific font, i.e. fixed font in this instance, and then reset it when you are done. I would start off with your printer manual and see if it has a listing of the pcl command (called escape codes) that you will send to the printer in order to accomplish this.

History of PCL

From Google Search - there were others.

Jim Osieczonek
Delta Business Group, LLC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top