Converting the web application code in windows form application code
Good morning everybody...
the following code works well in .aspx page that is in
web application..
now the same thing i want to do in windows form application.. can anybody help me..
The code is for without saving the pdf file take a print..
it works well in .aspx page
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load("E:\\Report1\\over\\CrystalReport1.rpt");
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load("E:\\Report1\\over\\CrystalReport1.rpt");
MemoryStream oStream; // using System.IO
oStream = (MemoryStream)
cryRpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/pdf";
Response.BinaryWrite(oStream.ToArray());
Response.End();
In windows form the Response .clear or response.buffer is not supported
error is missing namespace or directive is displaying...
Re: Converting the web application code in windows form application code
You nee to open the pdf using System.IO.Process.Start("Pdf filename"). This will open the pdf in default editor
Re: Converting the web application code in windows form application code
hi
i've tryed the following code but it is saving the pdf file..
i dont want to save the file instead i want to export the pdf file
and take the print and when i close it should not be saved in memory..
There's one option using buffer but how to use this in windows form
i dont know..
the following is my code which saves the pdf file.
private void Form1_Load(object sender, EventArgs e)
{
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load("E:\\Report1\\over\\CrystalReport1.rpt");
ExportOptions CrExportOptions ;
DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
PdfRtfWordFormatOptions CrFormatTypeOptions = new pdfRtfWordFormatOptions(); cryRpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
CrDiskFileDestinationOptions.DiskFileName = "C:\\Documents and Settings\\DEV002\\Desktop\\aa.pdf";
CrExportOptions = cryRpt.ExportOptions;
{
CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
CrExportOptions.FormatOptions = CrFormatTypeOptions;
}
cryRpt.Export();
}
but i want to export without saving the file..
Re: Converting the web application code in windows form application code