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

Specifying a printer using the frx metadata of a report 1

Status
Not open for further replies.

jjjt

Technical User
Sep 15, 2002
34
GB
We have an application that will print reports to the Windows default printer unless a Prompt For Printer checkbox is ticked, in which case the user can select the printer they wish to print to.

However, what I want to do is send the report to a printer other than the default printer without having to go through the Prompt For Printer dialogue.

I do not have access to the application code but I do have access to the report frx file. I know that the printer settings are embedded in the frx file and that it is possible to hack the frx file. We have had some success with this in the past and have succeeded in sending reports to different trays on a single printer and such like. However, I cannot work out how to hack the frx file in such a way that the report prints to the printer specified in the frx and not the default printer. Is this possible, or is there an alternative solution?

Any ideas would be much appreciated.
 
jjjt

If you have VFP, have you tried using the report like a table, and changing the infomation in the Expr field of record 1?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
If you have access to the reports, then you can hack the report header related to printer specification and then hack it.

For example...

USE myRreport.FRX
LOCATE
REPLACE Expr WITH "", Tag WITH "", Tag2 WITH ""
USE

This will remove all information related to printer.

However, if you only want to remove the printer then..

there will be a line in EXPR memo field..
DEVICE=.... showing printer ....
Just remove this line and save the memo field.

:)



ramani :)
(Subramanian.G)
 
Thanks for replying. I've tried browsing the report as a table and editing the Expr field. I was hoping that I could specify a printer as below and the report would always print to that printer rather than the Windows default.

DRIVER=winspool
DEVICE=HP 1100
OUTPUT=192.192.192.115
ORIENTATION=0
PAPERSIZE=9
SCALE=100
ASCII=100
COPIES=1
DEFAULTSOURCE=7
PRINTQUALITY=300
COLOR=1
YRESOLUTION=300
TTOPTION=3
COLLATE=1

However, even with the above, the report will still print to the Epson, my default printer, and not the HP 1100.

I've tried deleting all info out of the Expr and the Tag 1 and 2 fields but the report still prints on the default printer - I guess this is because it has no other info telling it to print elsewhere.

I've got a feeling that it is not possible to achieve what I want - namely to embed in the report the printer on which it should print - by simply hacking the frx file. My hunch is that the app is overriding whatever I put in the Expr field of the report.

I'm not giving up on it yet, though, so any further ideas would be welcome.
 
HI

I suggest you to do the following.

1. Set your HP printer as the default printer.
2. Create a dummy report in your VFP and save it.
3. Open up the report and see the line..
DEVICE = ... line and see how that is constructed.
4. Now open the report files and set them suitably using the above information.


If the above does not yield what you want, then

1. Set the default printer as your HP.
2. STart VFP and edit one by one all the reports.
3. Move some control in the report one position right and then back to left.. This is just to mock the report wizard as if the report is changed. Then save them back. The new printer driver info will be written by VFP.

After all the work is over, you can change back the default printer to epson.

:)

ramani :)
(Subramanian.G)
 
You can do it this way.

* get current default printer
lcCurrentPrinter = SET("PRINTER",3)

lcNewPrinter = "Name of new printer"
SET PRINTER TO NAME (lcNewPrinter)

REPORT FORM blah

SET PRINTER TO NAME (lcOldPrinter)

* to get a list of printers installed look at the array function APRINTER()





Jim Osieczonek
Delta Business Group, LLC
 
JJJt,

If I've understood your requirements correctly, you don't need to hack the FRX, or do anything else at all difficult.

You want to send the report to a specific printer -- one whose name you know at design time -- which is not necessarily the default VFP or Windows printer. You don't want to prompt the user for the printer. You want to do the whole things behind the scenes. Is all that correct?

If so, you merely need to:

SET PRINTER TO NAME <name of printer, as seen by Windows>

then print the report, then return to the default printer by executing

SET PRINTER TO DEFAULT

If I've misunderstood, my apologies.

Mike


Mike Lewis
Edinburgh, Scotland
 
jjjt

If the report only prints to the windows default printer no matter what the report say, I would empty the Expr field of the report (in other words no matter what it says you will be able to control where the report goes), and use Windows Scripting (Note this will change the Windows Default printer beyond the VFP session as oppose to the othe suggestions will only change within a VFP application):
Code:
oNet = CREATEOBJECT(&quot;WScript.Network&quot;)
oNet.SetDefaultPrinter(&quot;\\slp_nt_termserv\Panasonic Printer&quot;) && Or whatever, it can be local or network





Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top