capture fileDest from ReportViewer Export event FileSaveDialog?

R

Rich P

Hello,

In a winform app with a reportviewer control, a user can export (save)
the report as a pdf or excel file to some folder. This fires the
reportExport event which brings up a file save dialog window. I added a
debug.print to the export event, and it prints to the console before the
filesave dialog window comes up. Is there a way to
capture the filedestination string from this dialog window? Is there a
way to specify the default folder for this filesave dialog window (not
the filesave control from the toolbox). I think this filesave dialog
belongs to the reportviewer (correct me if I am wrong). Is there a way
to tap this filesave dialog?

Thanks

Rich
 
R

Rich P

I found something better for my purposes -- I want to Render the report
as Excel format and save to disk. Here is how to do it from code:

from:
http://msdn.microsoft.com/en-us/library/ms251839.aspx

protected void Button1_Click(object sender, EventArgs e)
{
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string extension;

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

FileStream fs = new FileStream(@"c:\output.xls",
FileMode.Create);
fs.Write(bytes, 0, bytes.Length);
fs.Close();

}



Rich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top