Click here to Skip to main content
15,914,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, im developing a windows form application and having trouble under the reports section. i used Report viewer to design my reports, everything works perfectly but I want to automaticaly send a copy of the report when it opens to the customer as an attachment and I don't know how, please help...
Posted
Comments
Richard MacCutchan 15-Aug-12 5:49am    
Attachment to what? Email, web page, carrier pigeon?
andilemtshali 15-Aug-12 6:00am    
As an Email attachment

1 solution

I found the solution :)
C#
using System.IO;
using System.Data.Sql;
using System.Data.SqlClient;
using Microsoft.Reporting.WinForms;



Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string extension;

byte[] bytes = reportViewer1.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings);

FileStream fs = new FileStream(@"D:\Report" + sales_code + ".pdf", FileMode.Create);

fs.Write(bytes, 0, bytes.Length);

fs.Close();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900