Berichtexport als PDF aus .NET heraus
Hallo!
Habe hier einen recht komplizierten Crystal-Report, den ich nur aufrufen will und anschließend als PDF speichern will. Mit den CrystalDecisions.CrystalReports*-Klassen funktioniert das auch in wenigen Zeilen Problemlos.
Das Programm muss jedoch auf einem Server laufen, auf dem nur Crystal Reports 8.5 installiert ist und deshalb muss ich nun den Export auf CRAXDRT-Klassen umschreiben.
Derzeit hab ich folgenden Code:
Dim App As New CRAXDRT.Application
Dim Report As CRAXDRT.Report
Report = App.OpenReport(Reportpfad)
Report.SetReportVariableValue("PARAMETER01", GLN(GLNNr).ToString)
Report.SetReportVariableValue("PARAMETER02", Format(Now(), "yyyyMMdd"))
Report.SetReportVariableValue("PARAMETER03", Format(Now(), "yyyyMMdd"))
Report.ExportOptions.FormatType = CRAXDRT.CRExportFormatType.crEFTPortableDocFormat
Report.ExportOptions.DestinationType = CRAXDRT.CRExportDestinationType.crEDTDiskFile
Report.ExportOptions.PDFExportAllPages = True
Report.ExportOptions.DiskFileName = "C:\Test.pdf"
So funktioniert das natürlich noch gar nicht. Wie bekomme ich die Verbindung auf die Datenbank zustande? Gibt es einen Weg, nur die DB-Connection Informationen zu hinterlegen oder muss man mit RecordSets arbeiten?
Danke für Antworten und Grüße
Gerhard
Habe hier einen recht komplizierten Crystal-Report, den ich nur aufrufen will und anschließend als PDF speichern will. Mit den CrystalDecisions.CrystalReports*-Klassen funktioniert das auch in wenigen Zeilen Problemlos.
Das Programm muss jedoch auf einem Server laufen, auf dem nur Crystal Reports 8.5 installiert ist und deshalb muss ich nun den Export auf CRAXDRT-Klassen umschreiben.
Derzeit hab ich folgenden Code:
Dim App As New CRAXDRT.Application
Dim Report As CRAXDRT.Report
Report = App.OpenReport(Reportpfad)
Report.SetReportVariableValue("PARAMETER01", GLN(GLNNr).ToString)
Report.SetReportVariableValue("PARAMETER02", Format(Now(), "yyyyMMdd"))
Report.SetReportVariableValue("PARAMETER03", Format(Now(), "yyyyMMdd"))
Report.ExportOptions.FormatType = CRAXDRT.CRExportFormatType.crEFTPortableDocFormat
Report.ExportOptions.DestinationType = CRAXDRT.CRExportDestinationType.crEDTDiskFile
Report.ExportOptions.PDFExportAllPages = True
Report.ExportOptions.DiskFileName = "C:\Test.pdf"
So funktioniert das natürlich noch gar nicht. Wie bekomme ich die Verbindung auf die Datenbank zustande? Gibt es einen Weg, nur die DB-Connection Informationen zu hinterlegen oder muss man mit RecordSets arbeiten?
Danke für Antworten und Grüße
Gerhard
Please also mark the comments that contributed to the solution of the article
Content-Key: 35519
Url: https://administrator.de/contentid/35519
Printed on: April 27, 2024 at 06:04 o'clock
1 Comment