Hi there,
I am using VB.NET2003 with CR.
I have a good working webform that exports the CR to pdf when I hit the
print button.
Now what I want is that it exports the CR to Excel instead of Pdf.
I have tried some options but it always goes wrong with the parameters.
Can anybody help me to modify my code that works for pdf so that it will
work for excel.
I really like it to be modified, so please no completely different solution
with the chance that it will not work for the parameters.
(When possible ofcourse)
This is the code:
Imports CrystalDecision s.CrystalReport s.Engine
Imports CrystalDecision s.CrystalReport s.Engine.Report Document
Imports CrystalDecision s.Shared
Imports System.IO
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
Dim BeginPeriode As Date
Dim EindPeriode As Date
BeginPeriode = Session("BeginP eriode")
EindPeriode = Session("EindPe riode")
Dim myReport As New _Rapport_KO_Zon derContract
Dim myParameterFiel ds As New ParameterFields
Dim myParameterFiel d As New ParameterField
Dim myRangeValues As New ParameterRangeV alue
Dim myRangeValue As New ParameterRangeV alue
myParameterFiel d.ParameterFiel dName = "Periode"
myRangeValue.St artValue = BeginPeriode
myRangeValue.En dValue = EindPeriode
myReport.SetPar ameterValue("Pe riode", myRangeValue)
crViewer.Report Source = myReport
'export to pdf
Dim myExportOptions As CrystalDecision s.Shared.Export Options
Dim myDiskFileDesti nationOptions As
CrystalDecision s.Shared.DiskFi leDestinationOp tions
Dim myExportFile As String
myExportFile = "\\192.168.2.10 6\syn2sql$\PDF_ " &
Session.Session ID.ToString & ".pdf"
myDiskFileDesti nationOptions = New
CrystalDecision s.Shared.DiskFi leDestinationOp tions
myDiskFileDesti nationOptions.D iskFileName = myExportFile
myExportOptions = myReport.Export Options
With myExportOptions
.DestinationOpt ions = myDiskFileDesti nationOptions
.ExportDestinat ionType = .ExportDestinat ionType.DiskFil e
.ExportFormatTy pe = .ExportFormatTy pe.PortableDocF ormat
End With
Try
myReport.Export ()
Catch err As Exception
Response.Write( "<BR>")
Response.Write( err.Message.ToS tring)
End Try
Session("export bestand") = myExportFile
End Sub
Kind regards,
Alison