Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
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 December 3, 2024, 11:14 am This article has been viewed 35396 times. Google search has resulted in 261 hits on this article since January 25, 2004.
|
|