Search code examples
crystal-reportscrystal-reports-export

Crystal Reports export to HTML


I use CrystalReports 13 (13.0.2000.0) in an ASP.NET 4.0 application.
I need to export report in HTML because i want a static report page, without reporviewer that allows user interaction.

If i try the following code:

 Source1.ReportDocument.ExportToHttpResponse(  
   CrystalDecisions.Shared.ExportFormatType.HTML32   /*or HTML40*/
   , this.Response  , false, "report");

Application generates an error (Detail: Export in HTTP response in HTML format is not supported.)

If i try ReportExporter, HTML32 and HTML40 are not available ase ExportFormat.

Can someone help?


Solution

  • Report can be viewed in HTML as

        MemoryStream oStream; // using System.IO
        oStream = (MemoryStream)
        rd.ExportToStream(
        CrystalDecisions.Shared.ExportFormatType.HTML40);
        Response.Clear();
        Response.Buffer = true;
        Response.ContentType = "text/html";
        Response.BinaryWrite(oStream.ToArray());
        Response.End();
    

    But the format may suffer.

    Reference: How to Export Crystal Report in ASP.NET