Solved

Visual FoxPro Crystal Reports Viewer Programmatically Printing the Selected View (page Tab) on the Crystal OLE Control

Posted on 2011-09-28
8
963 Views
Last Modified: 2012-05-12
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)?
0
Comment
Question by:ContrAcct
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 36718740
How are you printing?
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
0
 

Author Comment

by:ContrAcct
ID: 36718845
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:

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

Open in new window

0
 
LVL 101

Expert Comment

by:mlmcc
ID: 36744090
I don't know how to do it.

mlmcc
0
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 

Author Comment

by:ContrAcct
ID: 36817424
Does anyone else have any ideas?
0
 

Author Comment

by:ContrAcct
ID: 36818303
What about using the Crystal Reports Print Control ActiveX object? Does any have an foxpro experience with printing using that control?
0
 

Accepted Solution

by:
ContrAcct earned 0 total points
ID: 36905088
Found a Crystal Reports Viewer 11.5 ActiveX Control that uses a better Windows printer dialog. It prints correctly. As a warning to others, though, it does not like to be placed on a modal form. Previous versions of the Viewer ActiveX Control could be jerry-rigged to work correctly. 11.5 could not.

Thanks anyway.
0
 

Author Closing Comment

by:ContrAcct
ID: 36935276
The other answers were barely helpful and actually dismissive.
0

Featured Post

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question