|
-
Oct 4th, 2010, 12:38 AM
#1
Thread Starter
Junior Member
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...
-
Oct 4th, 2010, 02:35 AM
#2
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
Please mark you thread resolved using the Thread Tools as shown
-
Oct 4th, 2010, 02:44 AM
#3
Thread Starter
Junior Member
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..
-
Oct 4th, 2010, 03:46 AM
#4
Re: Converting the web application code in windows form application code
Please mark you thread resolved using the Thread Tools as shown
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|