0

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...

Edited by __avd: Added [code] tags.

2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by __avd
0

if i use the cryRpt.exporttodisk then it will save to the disk..
i dont want to save the file i want to use the buffer and
i want to take the print..
the following is my code.. in windows form

ReportDocument cryRpt = new ReportDocument();
cryRpt.Load("E:\\Report1\\over\\CrystalReport1.rpt");
ExportOptions CrExportOptions ;
DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions();
//MemoryStream oStream; // using System.IO
// oStream = (MemoryStream)
cryRpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
CrDiskFileDestinationOptions.DiskFileName = (oStream.ToString()); 
CrExportOptions = cryRpt.ExportOptions;
{
 CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
 CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
 CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
 CrExportOptions.FormatOptions = CrFormatTypeOptions;
}
cryRpt.Export();
}

Edited by __avd: Added [code] tags.

0

Hi vinayak.v

Please read member-rule before posting again. Members who break a rule will usually be warned, followed by a points-based infraction for subsequent offenses.

Keep it Clear
1. Do post in full-sentence English
2. Do wrap your programming code blocks within [code] ... [/code] tags
3. Do use clear and relevant titles for new threads
4. Do not write in all uppercase or use "leet", "txt" or "chatroom" speak

Edited by __avd: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.