博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
C#:rdlc - 报表实例
阅读量:7171 次
发布时间:2019-06-29

本文共 862 字,大约阅读时间需要 2 分钟。

//报表定义
ReportViewer reportViewer = new ReportViewer();
//报表数据源
ReportDataSource datasource = null;
    //设置数据
    DataSet ds = null;  //请自行绑定数据
//指定报表模板地址
reportViewer.LocalReport.ReportPath = Server.MapPath("temp.rdlc");
//报表数据源设置
datasource = new ReportDataSource("TshirtMugData_Tshirt", ds.Tables[0]);
// 报表参数
ReportParameter[] reportpara = new ReportParameter[2];
reportpara[0] = new ReportParameter("Date", Date);
reportViewer.LocalReport.SetParameters(reportpara);
reportViewer.Visible = true;
// 写Excel文件
byte[] bytes = reportViewer.LocalReport.Render("Excel", null, out strMimeType, out strEncoding, out strFileNameExtension, out strStreamIds, out warnings);
if (!System.IO.File.Exists(filepath + filename))
{
    using (System.IO.FileStream fs = new System.IO.FileStream(filepath + filename, System.IO.FileMode.Create))
    {
        //写入文件
        fs.Write(bytes, 0, bytes.Length);
    }
}

转载地址:http://fmfzm.baihongyu.com/

你可能感兴趣的文章
2012.3.29聆听的高层领导报告_信息化发展趋势与深化数字福建建设
查看>>
Hadoop Hive 中几种排序方法的区别与比较
查看>>
关于tomcat manager app 404错误的解决
查看>>
Kickstart 自动化安装平台
查看>>
windows 释放内存
查看>>
php相关配置 -apache
查看>>
mysql AB复制搭建以及常见故障排查
查看>>
symantec backup exec 2010 部署《二》
查看>>
如何在CentOS7中添加Swap
查看>>
JVM生产环境参数实例设置及分析
查看>>
使用hybrid实现某医院专线与上网共存的方法
查看>>
Struts常用对象解析
查看>>
Sendmail和Dovecot实现伊妹儿服务(二)
查看>>
iOS-OC-基本控件之UIPageControl
查看>>
有用的英文缩写
查看>>
ceontos 7.3 部署 ceph12.1.1
查看>>
python学习之异常处理
查看>>
源码编译 PHP 完整配置选项
查看>>
sitemesh的简单回顾
查看>>
由大集合的映射引出的深层的OR不匹配问题
查看>>