`
李科笠
  • 浏览: 62817 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

水晶报表初体验

 
阅读更多

安装水晶报表后如下使用;

配置rpt文件,如图



 

 

前台(Asp.net页面):

 <%@ Register Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
    Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

<CR:CrystalReportViewer ID="ReTransport" runat="server" AutoDataBind="true" />

 

 

后台:

public void GetList()
        {
            ReportDocument doc = new ReportDocument();
            // rpt文件路径
            doc.Load(Server.MapPath("/Cry/CrystalInSchoolInfo.rpt"));
            ReTransport.ToolPanelView = ToolPanelViewType.None;
            Maticsoft.BLL.list.Lists pro = new Maticsoft.BLL.list.Lists();
            if (Session["CrystalData"]!=null)
            {
                //配置数据源dataset
                doc.SetDataSource((DataTable)Session["CrystalData"]);
                this.ReTransport.ReportSource = doc;
                this.ReTransport.DataBind();
            }
            else
            {
                HttpContext.Current.Response.Write("<script>alert('连接超时,请刷新!');window.location.href=document.referrer;</script>");
            }
        }

 

使用注意:rpt文件配置过程中,页面长度代表一列,若拉的太长,会默认增加到下一页,导致误判为无法遍历数据的错觉

 

 

 

 

  • 大小: 58.5 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics