zoukankan      html  css  js  c++  java
  • C#:rdlc 报表实例

    //报表定义
    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);
        }
    }
  • 相关阅读:
    虚拟机设置静态ip
    hadoop2.5重新编译问题
    python(2)-函数相关
    python(1)
    python中raw_input输入数字问题
    多线程-AsyncTask
    Handler消息处理机制
    01-Java多线程
    01.JS基本语法-数据类型和变量
    (4)RecyclerVIew
  • 原文地址:https://www.cnblogs.com/henw/p/2091112.html
Copyright © 2011-2022 走看看