Click here to Skip to main content
15,896,726 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,

I am using C#,ASP.NET,.NET FRAMEWORK 2.,crystal reports 9.
I have used a style class in crystal report.
But that styles are not applying when export to pdf and excel.

I am using the following code for exporting.
export to pdf
C#
Response.Buffer = false;
        // Clear the response content and headers
        Response.ClearContent();
        Response.ClearHeaders();
        try
        {
            // Export the Report to Response stream in PDF format and file name Customers
            myReport.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "OperationalResultsStandard");
            // myReport.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "");

            // There are other format options available such as Word, Excel, CVS, and HTML in the ExportFormatType Enum given by crystal reports
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
            ex = null;
        }


export to excel
C#
Response.Buffer = false;
       // Clear the response content and headers
       Response.ClearContent();
       Response.ClearHeaders();
       //Response.ContentType = "application/pdf";
       //Response.AddHeader("content-disposition", "inline;filename=report.pdf");
       try
       {
           // Export the Report to Response stream in Excel format and file name Customers
           myReport.ExportToHttpResponse(ExportFormatType.Excel, Response, false, "OperationalResultsStandard");
           // myReport.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "");

           // There are other format options available such as Word, PDF, CVS, and HTML in the ExportFormatType Enum given by crystal reports
       }
       catch (Exception ex)
       {
           Console.WriteLine(ex.Message);
           ex = null;
       }




Thanks in advance
george
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900