Joined: 26 Dec 2009
Location: Saudi Arabia
Online Status: Offline
Posts: 5
Topic: Export Crystal Report Posted: 28 Dec 2009 at 11:04am
hi all
I faced a problem when I’m going to export crystal report. I use the function ExportToDisk(specify format that I look for , specify the file name and directory);
Things go smooth if I don't add a parameter filed to the report BUT if I use it I got that error Missing parameter values.
// Returns a ReportDocument object with the report and data loaded privateReportDocument getReportDocument() {
// File Path for Crystal Report string repFilePath =Server.MapPath("Default2.rpt");
// Declare a new Crystal Report Document object // and the report file into the report document ReportDocument repDoc =newReportDocument(); repDoc.Load(repFilePath); //add param repDoc.SetParameterValue("MyName","Hussam"); repDoc.SetParameterValue("Old","26");
// Set the datasource by getting the dataset from business layer // In our case business layer is getCustomerData function
protectedvoid btnExport_Click(object sender,EventArgs e) { // Get the report document ReportDocument repDoc = getReportDocument(); // Stop buffering the response 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 repDoc.ExportToHttpResponse(ExportFormatType.PortableDocFormat,Response,true,"export"); // 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; } }
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum