Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Crystal Reports is generating very poor HTML output

Crystal Reports is generating very poor HTML output

Scheduled Pinned Locked Moved C#
htmlquestion
7 Posts 4 Posters 53 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PhilMcGahan
    wrote on last edited by
    #1

    --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)

    J P 2 Replies Last reply
    0
    • P PhilMcGahan

      --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)

      J Offline
      J Offline
      jschell
      wrote on last edited by
      #2

      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.

      P 1 Reply Last reply
      0
      • J jschell

        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.

        P Offline
        P Offline
        PhilMcGahan
        wrote on last edited by
        #3

        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.

        J 1 Reply Last reply
        0
        • P PhilMcGahan

          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.

          J Offline
          J Offline
          jschell
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • P PhilMcGahan

            --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)

            P Offline
            P Offline
            PhilMcGahan
            wrote on last edited by
            #5

            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

            Richard Andrew x64R Richard DeemingR 2 Replies Last reply
            0
            • P PhilMcGahan

              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

              Richard Andrew x64R Offline
              Richard Andrew x64R Offline
              Richard Andrew x64
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0
              • P PhilMcGahan

                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

                Richard DeemingR Offline
                Richard DeemingR Offline
                Richard Deeming
                wrote on last edited by
                #7

                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

                "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups