on 10-06-2008 11:00 AM
Hi there,
I am creating an addin for Crystal Reports 2008. Now, I would like to clear the shown report from within the addin.
Changing the datasource is no problem but some of the field still remain on the reports as well as the images. Is there an easy way to clear the whole document to have a blank report?
Thanks,
Pascal
Hello, Pascal;
Are you creating reports in Visual Studio .NET?
Normally you would create all of the reports you need with the fields as you require them. Then you pass each report object to a ReportDocument object releasing the report when you are finished with it, in the form unload of the viewer for example. Then load the next report required.
Here is an example I use for testing:
Dim crReportDocument As ReportDocument
Dim ReportFileName As String
Private Sub ConfigureCrystalReports()
'Create a new instance of your report object
crReportDocument = New ReportDocument()
'OpenFileDialog1 component to choose report
OpenFileDialog1.InitialDirectory = "c:\"
OpenFileDialog1.Filter = "rpt files (.rpt)|.rpt|All files (.)|."
OpenFileDialog1.ShowDialog()
OpenFileDialog1.RestoreDirectory = True
'Passes full path to the report
ReportFileName = OpenFileDialog1.FileName()
'Load the report document
crReportDocument.Load(ReportFileName, OpenReportMethod.OpenReportByTempCopy)
'Add any code you need e.g. logon to the database or pass a Selection Formula
'Pass the report to the viewer
myCrystalReportViewer.ReportSource = crReportDocument
End Sub
Elaine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, Pascal;
What method are you using to create the Addin? Could you explain more about what you are doing and what your requirements are?
You would have to loop through all of the report objects and delete them.
What would your plan be for putting each object you require back for the next report display? Creating a report at runtime takes special functionality and in some cases special licensing. It is not the usual way to display different reports at runtime.
Elaine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.