Hi,
I have a web application project which is done in VS2005.I am creating crystal report and i want to export it to pdf on a export button click. But an error is showing as 'Missing Parameter Value. The code i used is shown below:-
protected void btnExport_Click(object sender, EventArgs e)
{
System.IO.FileStream fs = null;
long FileSize = 0;
DiskFileDestinationOptions oDest = new DiskFileDestinationOptions();
string ExportFileName = Server.MapPath("\\Rpt_Disbursement_search.rpt") + "Export";
Rpt.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
Rpt.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
oDest.DiskFileName = ExportFileName;
Rpt.ExportOptions.DestinationOptions = oDest;
Rpt.Export();--ERROR IS SHOWN HERE
Response.Clear();
Response.Buffer = true;
Response.AddHeader("Content-Type", "application/pdf");
Response.AddHeader("Content-Disposition", "attachment;filename=Disbursement.pdf;");
fs = new System.IO.FileStream(ExportFileName, FileMode.Open);
FileSize = fs.Length;
byte[] bBuffer = new byte[Convert.ToInt32(FileSize) + 1];
fs.Read(bBuffer, 0, Convert.ToInt32(FileSize));
fs.Close();
Response.BinaryWrite(bBuffer);
Response.Flush();
Response.Close();
}
I am passing a parameter to the report.There's no problem in viewing the crystal report.Wat shud i do 2 resolve the problem while exporting to pdf?
Anybody please help me 2 solve this.
Thanks In Advance,
Ranjini