Question

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?

Was it helpful?

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

OTHER TIPS

Because you marked it up I thought I'd upgrade it to an answer for closure and the rep:

you could save the html document to disk and then use a redirect to that as a workaround but I can't find any other way of doing it. if you are going to do it that way make sure you add uniqueness to the fime name (I find datetime is a useful string) to support concurrency,

MD

Would pdf help (the examples that I have seen use pdf export)? if so that is easy to do but does require that your users have acrobat reader installed. From the error it seems that exporting to an http response in html format was not implemented at release but there may be a patch to fix it so try patching to latest version,

MD

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top