ContrAcct
asked on
Visual FoxPro Crystal Reports Viewer Programmatically Printing the Selected View (page Tab) on the Crystal OLE Control
I am using the Crystal Reports 9 ActiveX Ole Control on a Visual FoxPro 9 form. I am able to run reports correctly. Because we wanted our users to be able to select different printers besides their Windows default printer, we have over-ridden the control's print routines and display a standard Windows printer dialog. All this has been working fine.
My question involves reports with the ability to drill into groups. If our users drill into a group and then print, only the results from the preview tab are printed. How can I specify to print from the active view (page tab the user is sitting on when they click print)?
My question involves reports with the ability to drill into groups. If our users drill into a group and then print, only the results from the preview tab are printed. How can I specify to print from the active view (page tab the user is sitting on when they click print)?
ASKER
There must be a way to specify the active view for printing. I know how to find the active view index, I just need to know where to pass that value.
My form has an Ole Crystal control, and the control has a property that stores the report object. I have a custom printing routine that subverts the objects standard print routine. My VFP 9 code for printing is as follows:
My form has an Ole Crystal control, and the control has a property that stores the report object. I have a custom printing routine that subverts the objects standard print routine. My VFP 9 code for printing is as follows:
Local llReturnValue, lnSelect, lnOriginalOrientation
lnSelect = Select()
llReturnValue = .T.
llPrintToFileEnabled = .F.
Store "" to lcPortName, lcPrinterName, lcPrintRange
Store 0 to lnCopies, lnCollate, lnFromPage, lnToPage, lnOrientation
lnOriginalOrientation = this.oReport.PaperOrientation
lnReturnValue = WindowsPrinterDialog(llPrintToFileEnabled, @lcPrinterName, @lcPortName, @lnCopies, @lnCollate, @lcPrintRange, @lnFromPage, @lnToPage, @lnOrientation)
With this.oReport
If InList(lnReturnValue, 1, 2) && Print or apply
.SelectPrinter("", lcPrinterName, lcPortName)
.PaperOrientation = lnOriginalOrientation
If lnReturnValue = 1
llCollate = lnCollate = 1
Do Case
Case lcPrintRange = "RANGE"
.Printout(.F., lnCopies, llCollate, lnFromPage, lnToPage)
Case lcPrintRange = "CURRENT"
lnPageNo = this.GetCurrentPageNumber
.Printout(.F., lnCopies, llCollate, lnPageNo, lnPageNo)
Otherwise
.Printout(.F., lnCopies, llCollate)
EndCase
EndIf
EndIf
EndWith
Select (lnSelect)
Return llReturnValue
I don't know how to do it.
mlmcc
mlmcc
ASKER
Does anyone else have any ideas?
ASKER
What about using the Crystal Reports Print Control ActiveX object? Does any have an foxpro experience with printing using that control?
This is supposed to do it
https://smpdl.sap-ag.de/~sapidp/012002523100005986882008E/cr8_vb_rdc_print_drilldown.exe
Other samples
http://wiki.sdn.sap.com/wiki/display/BOBJ/Report+Designer+Component+SDK+COM+Samples#ReportDesignerComponentSDKCOMSamples-Exporting%2FPrinting
This shows how to get at viewer events
http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/c061bb21-efbd-2b10-899b-c6c0c18881b8
mlmcc
https://smpdl.sap-ag.de/~sapidp/012002523100005986882008E/cr8_vb_rdc_print_drilldown.exe
Other samples
http://wiki.sdn.sap.com/wiki/display/BOBJ/Report+Designer+Component+SDK+COM+Samples#ReportDesignerComponentSDKCOMSamples-Exporting%2FPrinting
This shows how to get at viewer events
http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/c061bb21-efbd-2b10-899b-c6c0c18881b8
mlmcc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The other answers were barely helpful and actually dismissive.
If you are printing through code you may have to capture the drill in parameters and pass them to the report. Not sure you can do that.
There is a printer select control you can put on the report. They should be able to et the printer then use the print icon to print the current page.
mlmcc