Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use CRViewer to preview Report From VFP7.0

Status
Not open for further replies.

AVAS

Programmer
Jan 10, 2003
16
CY
How Can i use Crystal Viewer(CRViewer) to view my reports through VFP7.0?

What Are the Stepts in order to use it?

What Commands Should i include in my code ?

Tnx
AVAS
 
AVAS

Typically, you should have an Activex called "Crystal Report viewer control". You put it on a form. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 

There is no way to do this programmatically?
Call it as an object or something?

 
AVAS

Here is a way: (Code by Craig Berntson)
Code:
Public oForm
oForm = CREATEOBJECT("form1","c:\Report1.Rpt")
oForm.show()
Define Class form1 As Form
	Caption = "Report Preview"
	oCrystal = .F.
	oReport = .F.
	Procedure Init
	Lparameters tcReport
	Local cr As crViewer.crViewer
	With This
		.WindowState = 2
		.oCrystal = Createobject("CrystalRuntime.Application")
		.oReport = .oCrystal.OpenReport(tcReport)
		With .oleCRViewer
			.EnableExportButton = .T.
			.EnableProgressControl = .T.
			.ReportSource = Thisform.oReport
			.EnableAnimationCtrl = .F.
			.ViewReport()
		Endwith
		.Visible = .T.
	Endwith
Endproc
	Procedure Resize
	With This.oleCRViewer
		.Top = 1
		.Left = 1
		.Height = This.Height - 2
		.Width = This.Width - 2
	Endwith
Endproc
	Procedure Error
	Lparameters nError, cMethod, nLine
	If nError != 1440
   	DoDefault()
	Endif
Endproc
	Procedure Destroy
      With This
		.oReport = Null
		.oCrystal = Null
	Endwith
Endproc
	Procedure Activate
	With This.oleCRViewer
		.Top = 1
		.Left = 1
		.Height = Thisform.Height - 2
		.Width = Thisform.Width - 2
	Endwith
Endproc
Enddefine
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 

Excuse me for bothering u again but I’m a bit confused!

Where am I supposed to write this code?

Tnx a lot!!!
 
AVAS
Excuse me for bothering u again but I’m a bit confused!
Where am I supposed to write this code?


There is no way to do this programmatically?

There is bit be of confusion here.
[ol][li]You asked if it could be done programmatically (meaning by code)[/li]
[li]I give you an example that creates a form to preview your report.[/li]
[li]And you ask "where to put the code?[/li][/ol]

I don't know...where ever you need to view your report?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Avas,

The code that Mike G gave you will create a form, with the report ready and visible. When you run the code, the form will appear.

Typically, you will have a menu option or button to launch a report. Just execute Mike's code (sorry, I should say Craig's code) in response to the menu or button.
Mike Lewis
Edinburgh, Scotland
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top