Any ideas why an export of a crystal document to html would stop working after updating the crystal enging to crystal 2010.
I am getting an error message that says Invalid Export Options. below is the code that has worked fine for years but doesn't now. I also included hte set html method that is being used to set teh document up as html. This is a vb.net solution.
Public Function PrintReportToHTML(ByVal strCrystalPath As String, ByVal ds As DataSet) As XmlStruct.HtmlReport Dim crReportDocument As ReportDocument Dim strMessage As String Dim hshParams As New Hashtable Dim table As DataTable Dim row As DataRow Dim keycolumn As DataColumn Dim valuecolumn As DataColumn Dim counter As Integer Dim strkey As String Dim strvalue As String Dim MyByte() As Byte Try 'Pull hash table values out of dataset table = ds.Tables(0) counter = 0 For Each row In table.Rows strkey = table.Rows(counter).Item(0).ToString() strvalue = table.Rows(counter).Item(1).ToString() hshParams.Add(strkey, strvalue) counter = counter + 1 Next 'reset counter to 0 counter = 0 'Parse crystal report name strCrystalPath = strCrystalPath.Replace("/","") crReportDocument = New ReportDocument crReportDocument = CreateReport(strCrystalPath, hshParams) Dim strGuid As String = Guid.NewGuid.ToString Dim HTMLBaseFolderName As String = RuntimeViewerDirectory & strGuid & "\" Dim HTMLFileName As String = "Report" SetFormatHtml(crReportDocument, False, False, HTMLBaseFolderName, HTMLFileName, False, 0, 0) crReportDocument.Export() crReportDocument.Close() crReportDocument.Dispose() crReportDocument = Nothing Dim ImageData As New XmlStruct.HtmlImageData ImageData = Me.HTMLImagesPrep(HTMLBaseFolderName & strCrystalPath.Replace(".rpt",String.Empty) & "\images") Dim MyString As String MyString = OpenHTMLandRead(HTMLBaseFolderName & strCrystalPath.Replace(".rpt", String.Empty) & "\", HTMLFileName & ".html", ImageData) Dim HtmlReport As New XmlStruct.HtmlReport HtmlReport.HtmlText = MyString HtmlReport.HtmlImages = ImageData.HtmlImages Return HtmlReport Catch engEx As LogOnException strMessage = "RPT:" & strCrystalPath & " - Incorrect Logon Parameters. Check your user name and password." Throw New Exception(strMessage) Catch engEx As DataSourceException strMessage = "RPT:" & strCrystalPath & " - An error has occurred while connecting to the database." Throw New Exception(strMessage) Catch engEx As EngineException strMessage = "RPT:" & strCrystalPath & " - " & engEx.Message Throw New Exception(strMessage) End Try End Function Private Sub SetFormatHtml(ByRef MyReport As CrystalDecisions.CrystalReports.Engine.ReportDocument, _ ByVal EnableSeperatedPages As Boolean, _ ByVal HasPageNavigator As Boolean, _ ByVal HTMLBaseFolderName As String, _ ByVal HTMLFileName As String, _ ByVal UsePageRange As Boolean, _ ByVal FirstPageNumber As Integer, _ ByVal LastPageNumber As Integer) 'Set the destination type to HTML Dim Options As New CrystalDecisions.Shared.HTMLFormatOptions If UsePageRange Then End If End Sub
Message was edited by: Ludek Uher