Crystal Reports is generating very poor HTML output
-
--When crystal reports is used to create HTML the output is poorly formatted. --The same report will create a nice looking RTF file. --I have tried all the options I can find, but the resulting HTML is too poor to be used in email unless the report rpt only produces very simple text output. Poor results if formatting uses underlining or tables. Can you suggest an approach? Dim htmlOpts As HTMLFormatOptions = ExportOptions.CreateHTMLFormatOptions() htmlOpts.HTMLBaseFolderName = Path.GetTempPath() htmlOpts.HTMLFileName = ReportFileName + randomPartOfFileName + "Html" htmlOpts.HTMLHasPageNavigator = False htmlOpts.HTMLEnableSeparatedPages = False Dim exportOpts As ExportOptions = New ExportOptions() exportOpts.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.HTML40 << creates really bad html exportOpts.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.HTML32 << creates readable but poorly formatted in gmail or outlook exportOpts.ExportDestinationType = ExportDestinationType.DiskFile exportOpts.FormatOptions = htmlOpts exportOpts.ExportDestinationOptions = diskopts oReport.Export(exportOpts)
-
--When crystal reports is used to create HTML the output is poorly formatted. --The same report will create a nice looking RTF file. --I have tried all the options I can find, but the resulting HTML is too poor to be used in email unless the report rpt only produces very simple text output. Poor results if formatting uses underlining or tables. Can you suggest an approach? Dim htmlOpts As HTMLFormatOptions = ExportOptions.CreateHTMLFormatOptions() htmlOpts.HTMLBaseFolderName = Path.GetTempPath() htmlOpts.HTMLFileName = ReportFileName + randomPartOfFileName + "Html" htmlOpts.HTMLHasPageNavigator = False htmlOpts.HTMLEnableSeparatedPages = False Dim exportOpts As ExportOptions = New ExportOptions() exportOpts.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.HTML40 << creates really bad html exportOpts.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.HTML32 << creates readable but poorly formatted in gmail or outlook exportOpts.ExportDestinationType = ExportDestinationType.DiskFile exportOpts.FormatOptions = htmlOpts exportOpts.ExportDestinationOptions = diskopts oReport.Export(exportOpts)
PhilMcGahan wrote:
create HTML the output is poorly formatted.
No idea what that means. If you open the html in a browser does it work? Then Crystal Reports did what is supposed to. If you mean you open the html output in a normal editor and it is not 'pretty' then that is a you problem not a Crystal Reports problem. You can fix it by finding a different application which runs from the command line and does a pretty print on html. Then add that to your report construction process.
-
PhilMcGahan wrote:
create HTML the output is poorly formatted.
No idea what that means. If you open the html in a browser does it work? Then Crystal Reports did what is supposed to. If you mean you open the html output in a normal editor and it is not 'pretty' then that is a you problem not a Crystal Reports problem. You can fix it by finding a different application which runs from the command line and does a pretty print on html. Then add that to your report construction process.
With respect. If SAP created a calculator product that only worked with single digits would you suggest there is some thing wrong with the number 11. SAP Crystal Reports creates usable HTML if the RPT file does not underline text or contains tables. I am asking if anyone has experience taking a Crystal RPT and saving the output as html.
-
With respect. If SAP created a calculator product that only worked with single digits would you suggest there is some thing wrong with the number 11. SAP Crystal Reports creates usable HTML if the RPT file does not underline text or contains tables. I am asking if anyone has experience taking a Crystal RPT and saving the output as html.
PhilMcGahan wrote:
you suggest there is some thing wrong with the number 11.
Your original post did not suggest that it did not work. All you said was "is poorly formatted" You might want to do the following 1. Explain in detail what the exact problem is. 2. Provide an small example that demonstrates the problem. 3. If you post code to this site then use code tags.
PhilMcGahan wrote:
I am asking if anyone has experience taking a Crystal RPT and saving the output as html.
Googling suggests many people have. Far as I can recall I only used it for Word and CSV. The Word output was fairly complex. It did require work arounds. But I did that 20 years ago. And the work around was due to memory constraints.
-
--When crystal reports is used to create HTML the output is poorly formatted. --The same report will create a nice looking RTF file. --I have tried all the options I can find, but the resulting HTML is too poor to be used in email unless the report rpt only produces very simple text output. Poor results if formatting uses underlining or tables. Can you suggest an approach? Dim htmlOpts As HTMLFormatOptions = ExportOptions.CreateHTMLFormatOptions() htmlOpts.HTMLBaseFolderName = Path.GetTempPath() htmlOpts.HTMLFileName = ReportFileName + randomPartOfFileName + "Html" htmlOpts.HTMLHasPageNavigator = False htmlOpts.HTMLEnableSeparatedPages = False Dim exportOpts As ExportOptions = New ExportOptions() exportOpts.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.HTML40 << creates really bad html exportOpts.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.HTML32 << creates readable but poorly formatted in gmail or outlook exportOpts.ExportDestinationType = ExportDestinationType.DiskFile exportOpts.FormatOptions = htmlOpts exportOpts.ExportDestinationOptions = diskopts oReport.Export(exportOpts)
Solution: 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
-
Solution: 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
I'm glad you were able to figure out a solution. Just as an aside, that looks like VB, not C#. You posted in the wrong forum.
The difficult we do right away... ...the impossible takes slightly longer.
-
Solution: 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
NB: That is a commercial product, starting at $599 per developer. Given the eight year break in messages, and the recent flurry of very similar messages, I'm starting to suspect your account has been taken over by a spammer. :suss:
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer