cancel
Showing results for 
Search instead for 
Did you mean: 

Export of RPT to af file using ExportOption CrystalDecisions.Shared.ExportFormatType.HTML32 produces

PhilMcg
Discoverer
0 Kudos

If I export a RTP to a RTF, PDF or DOCX file the formatting is correct (or a least the resulting file looks good.)

If I export the same RPT using Export option CrystalDecisions.Shared.ExportFormatType.HTML32 or CrystalDecisions.Shared.ExportFormatType.HTML40 the resulitng HTML drops underlining of text and tables are not formatted correctly. I want to generate the body of emails via ExportFormatType.HTML32, but the resulting email is poorly formatted.

I have tried all options like  HTMLHasPageNavigator and HTMLEnableSeparatedPages but it does not improve the resulting HTML output.

I have tried the newest and sereral older versions of Crystal for Visual Studio, each produces different HTML but none produce HTML that could be used in an email to a customer.

Accepted Solutions (0)

Answers (1)

Answers (1)

PhilMcg
Discoverer
0 Kudos

To get perfect HTML out of Crystal Reports, out put your report to PDF, then use nuget package SautinSoft.pdfFocus to convert the pdf to HTML.  I have tried many ways, this way works.

 

Public Shared Function ConvertPDftoHtml(pdfFile As String) As String
Dim htmlFileOut As String = pdfFile.ToLower().Replace(".pdf", ".html")
If File.Exists(htmlFileOut) Then
File.Delete(htmlFileOut)
End If

Try
Dim f As PdfFocus = New SautinSoft.PdfFocus()
f.OpenPdf(pdfFile)
If f.PageCount > 0 Then
Dim iResult As Int32 = f.ToHtml(htmlFileOut)
End If
f = Nothing
Catch ex As Exception
File.WriteAllText(htmlFileOut, $"ConvertPDftoHtml() Reports: {ex.ToString}")
End Try

Return htmlFileOut
End Function