--设置水晶报表的打印功能
CrystalReportViewer1.PrintMode = CrystalDecisions.Web.PrintMode.ActiveX
--设置水晶报表的文件的相对路径
CrystalReportSource1.ReportDocument.Load(Server.MapPath("XXX.rpt"))
--设置水晶报表的数据源
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables("XXX"))
--设置水晶报表的传入参数
CrystalReportSource1.ReportDocument.ParameterFields("水晶报表中的参数名").CurrentValues.AddValue(传入参数值)
--将数据绑定到水晶报表
CrystalReportSource1.DataBind()
CrystalReportViewer1.DataBind()
--水晶报表是否可见
CrystalReportViewer1.Visible = True
--水晶报表的滚动条
CrystalReportViewer1.BestFitPage = True
--水晶报表公司的LOGO可见
CrystalReportViewer1.HasCrystalLogo = True
-水晶报表的搜索功能
CrystalReportViewer1.HasSearchButton = True
--水晶报表打印功能
CrystalReportViewer1.HasPrintButton = True
--水晶报表导出功能
CrystalReportViewer1.HasExportButton = True
--水晶报表工具栏树状功能
CrystalReportViewer1.HasToggleGroupTreeButton = True
--显示或隐藏工具栏上视图列表(主报表)
CrystalReportViewer1.HasViewList = True
--获取或设置浅化按钮可见性(向上)
CrystalReportViewer1.HasDrillUpButton = True
--显示或隐藏工具栏上导航按钮
CrystalReportViewer1.HasPageNavigationButtons = True
--显示或隐藏工具栏上跳转按钮
CrystalReportViewer1.HasGotoPageButton = True
--显示或隐藏工具栏上缩放按钮
CrystalReportViewer1.HasZoomFactorList = True
--筛选公式
CrystalReportViewer1.SelectionFormula = "{Customer.Last Year's Sales} > 11000.00 " + "AND Mid({Customer.Customer Name}, 1, 1) = \"A\""
--显示或隐藏工具栏
CrystalReportViewer1.DisplayToolbar = True
--显示或隐藏组树
CrystalReportViewer1.DisplayGroupTree = True
--显示或隐藏页面视图
CrystalReportViewer1.DisplayPage = True
--获取或设置报表页是分开还是连接?
CrystalReportViewer1.SeparatePages = True
--设置边框宽度
CrystalReportViewer1.BorderWidth = Convert.ToInt32("borderWidth")
--跳转页
CrystalReportViewer1.ShowNthPage(Convert.ToInt32("pageNumber"))
--缩放
CrystalReportViewer1.Zoom(Convert.ToInt32("zoomFactor"))
--水晶报表工具条的长度
CrystalReportViewer1.ToolbarStyle.Width = New Unit("1000px")
--水晶报表第一页
CrystalReportViewer1.ShowFirstPage()
--水晶报表最后一页(先取第一页,再取最后一页,然后再取第一页,可以保证水晶报表可以连续跳转下一页,且总页数完整显示)
CrystalReportViewer1.ShowLastPage()
CrystalReportViewer1.ShowFirstPage()
--水晶报表包含多页数据,单击下一页时,一直跳转到第二页
解决方法:将水晶报表的数据绑定放在page的init事件中