ReportViewer报表导出成Excel,Image,PDF---LocalReport.Render
来源:互联网 发布:ubuntu 解压缩命令 编辑:程序博客网 时间:2024/05/23 12:17
LocalReport.Render 方法 (String, String, String, String, String, String[], Warning[])
处理报表,并以指定的格式呈现报表。
命名空间: Microsoft.Reporting.WinForms
程序集: Microsoft.ReportViewer.WinForms(在 microsoft.reportviewer.winforms.dll 中)
public override byte[] Render ( string format, string deviceInfo, [OutAttribute] ref string mimeType, [OutAttribute] ref string encoding, [OutAttribute] ref string fileNameExtension, [OutAttribute] ref string[] streams, [OutAttribute] ref Warning[] warnings)
参数
呈现报表所用格式。此参数映射到一个呈现扩展插件。支持的格式包括 Excel、PDF 和 Image。
包含设备特定内容的 XML 字符串,该内容是格式参数中指定的呈现扩展插件所需的。有关特定输出格式的设备信息设置的详细信息,请参阅 SQL Server 2005 Reporting Services 文档中的“设备信息设置”。
[out] 呈现的报表的 MIME 类型。
[out] 呈现报表的内容时使用的编码。
[out] 用于输出文件的文件扩展名。
[out] 流标识符。您可以使用它们来呈现与报表相关联的外部资源(例如,图像)。
[out] 描述报表处理期间出现的任何警告的一组 Warning 对象。
返回值
采用指定格式的报表的 Byte 数组。示例
以下代码示例假定一个包含 ReportViewer 控件和按钮的 Windows 窗体应用程序。该代码显示了加载到控件中并在其中呈现的本地报表,以及用于将报表导出为 Microsoft Excel 格式的Render 方法。
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using Microsoft.Reporting.WinForms;using System.IO;namespace SampleCode{ public partial class Form1 : Form { private DataTable LoadSalesData() { // Load data from XML file. DataSet dataSet = new DataSet(); dataSet.ReadXml(@"c:\Reports\data.xml"); return dataSet.Tables[0]; } public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { this.reportViewer1.ProcessingMode = ProcessingMode.Local; this.reportViewer1.LocalReport.ReportPath = @"c:\Reports\Report1.rdl"; reportViewer1.LocalReport.DataSources.Add( new ReportDataSource("Sales", LoadSalesData())); this.reportViewer1.RefreshReport(); } private 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(); MessageBox.Show("Report exported to output.xls", "Info"); } }}
相关链接:http://msdn.microsoft.com/zh-cn/library/ms252207(VS.80).aspx
- ReportViewer报表导出成Excel,Image,PDF---LocalReport.Render
- ReportViewer rdlc 报表导出 pdf 中文乱码
- Excel PDF报表的导出
- ReportViewer 导出Excel或PDF无法打开问题
- 水晶报表导出PDF or Excel
- 页面列表导出cvs,excel、pdf报表
- 水晶报表导出PDF or Excel
- ReportViewer控件 Excel导出问题解决
- reportviewer中的localreport使用自定义数据源
- 怎样禁止ReportViewer工具栏上的导出为Excel、WORD、PDF按钮?
- 水晶报表导出为word,excel和pdf格式
- 水晶报表导出为word,excel和pdf格式
- jasperreport实现Html、Pdf、Rtf、Excel、Xml报表导出
- jasperreports制作报表(导出pdf excel html)
- jasperreport实现Html、Pdf、Rtf、Excel、Xml报表导出
- jasperreport实现Html、Pdf、Rtf、 Excel、Xml报表导出
- jasperreports制作报表(导出pdf excel html)
- jasperreport整合structs2导出PDF,Excel等报表
- linux I2C 驱动之----i2c_client 的注册
- Xcode 4的Build目录位置
- "_kCMTimeInvalid", referenced from 错误原因
- PHP中可变变量到底有什么用?
- 华为,你将被谁抛弃——华为十大内耗问题浅析
- ReportViewer报表导出成Excel,Image,PDF---LocalReport.Render
- Winsock API: connect
- Cuda stream programming
- java 使用rxtx 进行串口交流。
- SDL 1.3 on iOS
- 建网站
- Android Service获得手机信息:
- ARM-Linux配置DHCP自动获取IP地址
- 使用存储过程实现显示搜索结果和数据条数