Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Printer default IN CR 8.5
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Crystal Reports
Divers
Thread ID:
00779102
Message ID:
00779110
Vues:
18
I would make a suggestion, since the user might not want to send the job to the default window printer (or VFP default printer), you may want to offer him the option to choose a printer:(This was done in VFP IDE, replace the hWnd to accomodate your own form's hWnd)
ocrapplication = CREATEOBJECT('CrystalRuntime.Application.8.5')
orep=ocrapplication.OpenReport("c:\report1.rpt")
orep.PrinterSetup(_screen.HWnd)
This will bring up the printer selector.

Or your can set the printer you want right into VFP with :
SET PRINTER TO NAME GETPRINTER()
The use the SelectPrinter() of Crystal by using:
myPrinter = SET("PRINTER",3)
orep.SelectPrinter(myPrinter,myPrinter,"LPT1")
Or if you really want to make sure it will go to the right printer, you can make the selected printer the Windows default printer. (Sometimes that is the only way to do it).
SET PRINTER TO NAME GETPRINTER()
myPrinter = SET("PRINTER",3)
oNet = CREATEOBJECT("WScript.Network")
oNet.SetDefaultPrinter(myPrinter)
If you use this, it will chage the Windows default printer for all other applications, you may consider to set it back after.






>Mike,
>
>Thanks for your Answer.
>I wrote a small program which prepares the reports to distribute to the customers.
>I would like that they use their default printer.
>If I modify printerName , you one will use their default printer ?
>
>bernhart
>
>
>
>>You can specify the Windows default printer or VFP default printer.
>>
>>Local cDef_printer
>>cDef_printer = SET("PRINTER",2)  && Or SET("PRINTER",3)
>>ocrreport.PrinterName=cDef_printer
>>
>>
>>You can also specify:
>>ocrreport.papersize
>>occreport.papersource
>>occreport.paperorientation
>>
>>
>>>Hello,
>>>
>>>I would like by programming to place a default printer in
>>>reports 8.5.
>>>
>>>I do not find this property in documentation.
>>>somebody can it help me?
>>>
>>>thank you in advance.
>>>
>>>
>>>
>>>SET DEFAULT TO ( cdirectory )
>>>
>>>gnNombreDbc = ADIR( gaBaseDonnées, '*.Rpt')  && Crée un tableau
>>>SET DEFAULT TO (  SetOldDefault )
>>>
>>>ocrapplication = CREATEOBJECT('CrystalRuntime.Application.8.5')
>>>
>>>
>>>FOR nCompteur = 1 TO gnNombreDbc     && Effectue une boucle pour connaître le nombre de bases de données
>>>   cName = "C:\cdbk70\amline\ReportsCrystal\" + PROPER( gaBaseDonnées( nCompteur , 1 ) )
>>>    WAIT WIND cName  NOWAIT     && Affiche le nom des bases de données
>>>
>>>   ocrreport  = ocrapplication.OpenReport( cName , 1 )
>>>   ocrreport.DATABASE.verify()
>>>   ocrreport.SAVEAS( cName , 2048 )
>>>   ocrreport = .NULL.
>>>ENDFOR
>>>
>>>
>>>
>>>MILCENT bernhart
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform