on 02-29-2024 5:23 PM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
10 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.