不用一个个地导入rpt文件,再去写固定的代码,而是每次动态的根据指定的名称去加载报表和打印
 
  if(Session["PrintXml"]!=null)
   {
    ReportDocument rd=new ReportDocument();
    rd.Load (this.Server.MapPath("\\Flow\\FlowForm\\rpt")+"\\"+Session["PrintFormName"]+".rpt");
    rd.SetDataSource(XmlPage.GetDataSet( Session["PrintXml"].ToString(),"FlowData"));
    
    cr.ReportSource=rd;
   }

当然,报表必须和下面要取得的dataset配套才行。我的做法是:如果dataset来自数据库的表自然最好,否则,用access建立一个临时的表,结构和dataset一样,建成的rpt和dataset同样可以匹配。

相关文章:

  • 2022-01-09
  • 2022-12-23
  • 2021-05-11
  • 2021-09-19
  • 2021-04-11
  • 2021-05-24
猜你喜欢
  • 2021-11-22
  • 2021-05-19
  • 2022-12-23
  • 2022-01-07
  • 2021-08-20
相关资源
相似解决方案