report from reportviewer without viewing the control
2009-09-03 11:41
246 查看
It exports both xls and pdf. Try that.
private void ExportData(LocalReport report, string extension)
{
// Out params to pass into the Render method
Microsoft.Reporting.WebForms.Warning[] warnings;
string[] streamids;
string mimeType, encoding, extensionOut;
report.EnableHyperlinks = true;
byte[] bytes = report.Render(extension, null, out mimeType,
out encoding, out extensionOut,
out streamids, out warnings);
Response.Clear();
Response.ContentType = mimeType;
Response.AppendHeader("Content-Disposition",
string.Format("attachment; filename={0}.{1}",
DateTime.Now.ToString("yyyyMMdd"), extensionOut));
Response.BinaryWrite(bytes);
Response.End();
}
private void ExportData(LocalReport report, string extension)
{
// Out params to pass into the Render method
Microsoft.Reporting.WebForms.Warning[] warnings;
string[] streamids;
string mimeType, encoding, extensionOut;
report.EnableHyperlinks = true;
byte[] bytes = report.Render(extension, null, out mimeType,
out encoding, out extensionOut,
out streamids, out warnings);
Response.Clear();
Response.ContentType = mimeType;
Response.AppendHeader("Content-Disposition",
string.Format("attachment; filename={0}.{1}",
DateTime.Now.ToString("yyyyMMdd"), extensionOut));
Response.BinaryWrite(bytes);
Response.End();
}
相关文章推荐
- (Reporting Made Easy)The New ReportViewer Control in Visual Studio 2005 Provides Rich Capabilities to Fulfill All Your Reporting Needs
- (Microsoft.Reporting.WebForms.ReportViewer) is not compatible with the type of control (Microsoft.Reporting.WebForms.ReportViewer)
- Using the ReportViewer ASP.NET Control in Windows Azure
- How do you copy the contents of an array to a std::vector in C++ without looping? (From stack over flow)
- Microsoft SQL Reporting Services – Running a Report from the Command Line
- See screenshots of some applications that have ReportViewer control embedded in them.
- Using the ASP.NET 2.0 ReportViewer in Local Mode
- Refresh a GridView control on the parent page, from a pop up window
- Control Statements of Java -from The Complete Reference Java
- Visual Studio 2013 ReportViewer Control
- How To Retrieve the URL of a Web Page from an ActiveX Control
- SSRS ReportViewer : Unable to load client print control
- Using the ASP.NET 2.0 ReportViewer in Local Mode
- Entering the kernel without a driver and getting interrupt information from APIC
- How to extract controlfiles, datafiles, and archived logs from SMR backupsets without using RMAN
- Cross-thread operation not valid: Control 'progressBar1' accessed from a thread other than the thread it was created on
- Dynamics AX 2009: Launching an SSRS report from the Dynamics AX client UI
- Report from the Cloud Computing Summit: Business Intelligence, Data Integration, and the Cloud
- How to pass a value from User Control to the Page
- ffmpeg 音频转换: use ffmpeg convert the audio from stereo to mono without changing the video part