Fastreport Rapor Çıktısını Tarayıcı Pencerecesinde Göstermek
protected void ButtonCALISIYOR_Click(object sender, EventArgs e)
{
// No temp files
FastReport.Utils.Config.WebMode = true;
// Set PDF export props
FastReport.Export.Pdf.PDFExport pdfExport = new FastReport.Export.Pdf.PDFExport();
pdfExport.ShowProgress = false;
pdfExport.Subject = "Subject";
pdfExport.Title = "xxxxxxx";
pdfExport.Compressed = true;
pdfExport.AllowPrint = true;
pdfExport.EmbeddingFonts = true;
// Load our report
FastReport.Report report = new FastReport.Report();
FastReport.EnvironmentSettings evn = new FastReport.EnvironmentSettings();
// evn.DatabaseLogin += new FastReport.DatabaseLoginEventHandler(evn_DatabaseLogin);
String DOSYA = Server.MapPath(@"~/FastPrint/DENEME.frx");
report.Load(DOSYA);
//report.SetParameterValue("ID", 123));
report.Prepare();
// Export report to PDF stream
MemoryStream strm = new MemoryStream();
report.Export(pdfExport, strm);
report.Dispose();
pdfExport.Dispose();
// Stream the PDF back to the client as an attachment
Response.ClearContent();
Response.ClearHeaders();
Response.Buffer = true;
Response.ContentType = "Application/PDF";
Response.AddHeader("Content-Disposition", "attachment;filename=some_filename.pdf");
strm.Position = 0;
strm.WriteTo(Response.OutputStream);
strm.Dispose();
Response.End();
{
// No temp files
FastReport.Utils.Config.WebMode = true;
// Set PDF export props
FastReport.Export.Pdf.PDFExport pdfExport = new FastReport.Export.Pdf.PDFExport();
pdfExport.ShowProgress = false;
pdfExport.Subject = "Subject";
pdfExport.Title = "xxxxxxx";
pdfExport.Compressed = true;
pdfExport.AllowPrint = true;
pdfExport.EmbeddingFonts = true;
// Load our report
FastReport.Report report = new FastReport.Report();
FastReport.EnvironmentSettings evn = new FastReport.EnvironmentSettings();
// evn.DatabaseLogin += new FastReport.DatabaseLoginEventHandler(evn_DatabaseLogin);
String DOSYA = Server.MapPath(@"~/FastPrint/DENEME.frx");
report.Load(DOSYA);
//report.SetParameterValue("ID", 123));
report.Prepare();
// Export report to PDF stream
MemoryStream strm = new MemoryStream();
report.Export(pdfExport, strm);
report.Dispose();
pdfExport.Dispose();
// Stream the PDF back to the client as an attachment
Response.ClearContent();
Response.ClearHeaders();
Response.Buffer = true;
Response.ContentType = "Application/PDF";
Response.AddHeader("Content-Disposition", "attachment;filename=some_filename.pdf");
strm.Position = 0;
strm.WriteTo(Response.OutputStream);
strm.Dispose();
Response.End();
Hiç yorum yok