Export to pdf/Excel/Word Manually

Posted by Sathya4260 under C# on 9/12/2011 | Points: 10 | Views : 1743 | Status : [Member] | Replies : 1
Hi,

I am working on windows application in which showing an rdlc report, Now i need to hide the report viewer toolbar and place an button and dropdown with options of Excel/PDF/Word, so when ever we select and click export button, the report should be exported, Can anyone guide me...

Sathish Kumar S


Responses

Posted by: Sksamantaray on: 2/7/2012 [Member] Silver | Points: 25

Up
0
Down
Hi ,
Try this..

public void createReport()
{
Warning[] warnings;

string[] streamids;

string mimeType;

string encoding;

string extension;



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



FileStream fs = new FileStream(@"c:\filename.pdf", FileMode.Create);

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

fs.Close();

}


protected void Button1_Click1(object sender, EventArgs e)
{
createReport();
}


Thanks,
Sanjay

Sathya4260, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response