Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Export Crystal Report Post Reply Post New Topic
Author Message
Hussam
Newbie
Newbie


Joined: 26 Dec 2009
Location: Saudi Arabia
Online Status: Offline
Posts: 5
Quote Hussam Replybullet Topic: Export Crystal Report
    Posted: 26 Dec 2009 at 4:43am

Good afternoon 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 director);

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.

 

What I should do plz?

 

Your cooperation is highly appreciatedWink

 

IP IP Logged
Hussam
Newbie
Newbie


Joined: 26 Dec 2009
Location: Saudi Arabia
Online Status: Offline
Posts: 5
Quote Hussam Replybullet Posted: 28 Dec 2009 at 1:55am
 
I upload my website for more clearly understood
The Defualt.aspx page is work fine BUT the Defualt 2.aspx has the above problem
 
Any help plz
IP IP Logged
Hussam
Newbie
Newbie


Joined: 26 Dec 2009
Location: Saudi Arabia
Online Status: Offline
Posts: 5
Quote Hussam Replybullet Posted: 04 Jan 2010 at 9:15am
using System;
using System.Data;
using System.Configuration;
using System.Data.OleDb;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

public partial class _Default : System.Web.UI.Page
{
   
protected void Page_Load(object sender, EventArgs e)
   
{

   
}

   
protected void btnShow_Click(object sender, EventArgs e)
   
{
       
CrystalReportViewer1.ReportSource = getReportDocument();
       
CrystalReportViewer1.DataBind();
   
}


   
// Returns a ReportDocument object with the report and data loaded
   
private ReportDocument 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 = new ReportDocument();
        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

       
CrystalReportViewer1.ReportSource = repDoc;
       
// repDoc.SetDataSource(repFilePath);
       

         
       
return repDoc;

   
}

   

   
protected void 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;
       
}
   
}

}
I got the above code which handle my problem
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
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



This page was generated in 0.033 seconds.