Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SET PRINTER TO NAME and REPORT FORM TO PRINTER
Message
From
29/10/1997 11:46:38
Matt Mc Donnell
Mc Donnell Software Consulting
Boston, Massachusetts, United States
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00057169
Message ID:
00057209
Views:
32
>>>I've a problem when I change the printer where I want to output the report, the report is always printed on the default printer.
>>>
>>>I've tried with this code :
>>>
>>>SET PRINTER TO NAME GETPRINTER()
>>>REPORT FORM myReport TO PRINTER
>>>
>>>My printers are on a Novel network or are device like Fax Driver
>>>
>>>It's a VFP 5.0 bug or I'm doing an error ?
>>>
>>>Thanks in advance,
>>
>>I had this problem too. The .frx saves the default printer information and codes. This is one of the shortcomings for foxpro (IMO). In any case, here is a solution. This solution only works if the same printer drivers and codes are used. Generally, all HPLJ's are the same, so it should work in *most* offices.
>>
>>
>>USE myreport.frx
>>REPL expr WITH '', tag WITH '', tag2 WITH ''
>> if the report is landscape, also do this:
>>REPL expr WITH 'ORIENTATION = 1'
>>
>>This removes the printer codes from the report and so output will be directed to the printer specified by SET PRINTER TO NAME MyDefaultPrinter.
>>
>>The other, simpler alternative is to use REPO FORM myReport TO PRIN PROM NOCO. This will allow VFP to override the printer codes specified by the report.
>>
>>I'll bet that there are other, more elegant solutions, but these are the easiest to implement.
>
>Hi Matt,
>thanks for your reply, but if I have unsertstood, you're saying that the only way to print my report on my fax driver (that is different from my default printer, an HPLJ too) it's to do a REPORT FORM myReport TO PRINTER PROMPT ?
>
>My problem is to make a form like "Choose printer" with a combo to choose the printer a some commandbutton (Print, Preview, Close) and putting this in a VCX, so other developer can customize this form easily. Any suggestion ? I've to use Common Dialog ActiveX ?
>
>Thanks,

AFAIK, VFP is VERY limited where this is concerned. An idea that I've toyed with, but not implemented is to determine all of the potential printers that will be used and then take a sample report and save it many times, changing the printer between each save. Then, save the control strings from eack field from the first row of the .frx (expr, tag and tag2) in a 'print setup' table and replacing these fields accordingly at run-time. This is a VERY limited option b/c it doesn't account for a new model that gets purchased tomorrow.

Again, this is only my idea. I wouldn't be surprised if someone else has a better one. (NOTE: if this method is used, the reports MUST be excluded from the project so they are not wrapped up in the executable. That's the only way to edit the printer controls.)

HTH
Matt McDonnell
...building a better mousetrap with moldy cheese...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform