` Selecting a printer from the CR preview (Jaak Bartels) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Reports, Printing, Printers: Selecting a printer from the CR preview
2002-11-23 -- Jaak Bartels
 
Newsgroups: softvelocity.products.c55ee What I've done to print (and preview) a test report is this: - Create a new form and put two ole controls on it: ole1 to contain the crystal reports application object, and oleViewer to contain the crystal reports report viewer. - Make ole1 hidden and size oleViewer large enough to see some of the report. - Declare a local variable oReport as CSTRING(20) - Put an "OPEN" button on the form, and embed the following code in its Accepted embed point: !Open the report ?ole1{prop:create} = 'CrystalRuntime.Application' oReport = ?ole1{'OpenReport("c:\my documents\test2.rpt")'} !View it in the previewer ?oleViewer{prop:create} = 'CRViewer9.CRViewer.9.2' ?oleViewer{'EnableAnimationCtrl'} = 0 ?oleViewer{'EnableExportButton'} = -1 ?oleViewer{'ReportSource'} = oReport ?oleViewer{'ViewReport'} This will show the report in the preview window. - Put a "Print" button on the form, and put this code in its accepted embed point: IF oReport IF PrinterDialog('Select a printer') ?ole1{oReport & '.SelectPrinter("' & | PRINTER{PROPPRINT:Driver} & '","' & | PRINTER{PROPPRINT:Device} & '","' & | PRINTER{PROPPRINT:Port} & '")' | } ?ole1{oReport & '.PaperOrientation'} = 0 ?ole1{oReport & '.PrintOut(FALSE)'} END!if END!if This will pop up a printer selection dialog and print the report to the printer you select. Hope this will get you on the way. Jaak


Today is November 21, 2024, 3:30 am
This article has been viewed 35383 times.
Google search has resulted in 261 hits on this article since January 25, 2004.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: