水晶报表的常用属性及方法
2014-02-13 20:10
295 查看
1、常用属性及方法
//常用属性
CrystalReportViewer1.HasToggleGroupTreeButton = true;//显示或隐藏工具栏上组树按钮
CrystalReportViewer1.HasExportButton = true;//显示或隐藏工具栏上导出按钮
CrystalReportViewer1.HasPrintButton = true;//显示或隐藏工具栏上打印按钮
CrystalReportViewer1.HasViewList = true;//显示或隐藏工具栏上视图列表(主报表)
CrystalReportViewer1.HasDrillUpButton = true;//获取或设置浅化按钮可见性(向上)
CrystalReportViewer1.HasPageNavigationButtons = true;//显示或隐藏工具栏上导航按钮
CrystalReportViewer1.HasGotoPageButton = true;//显示或隐藏工具栏上跳转按钮
CrystalReportViewer1.HasSearchButton = true;//显示或隐藏工具栏上搜索按钮
CrystalReportViewer1.HasZoomFactorList = true;//显示或隐藏工具栏上缩放按钮
CrystalReportViewer1.HasCrystalLogo = true;//显示或隐藏工具栏上LOGO
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"));//缩放
2、登陆验证
private void ConfigureCrystalReports()
{
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = ".";
connectionInfo.DatabaseName = "Northwind";
connectionInfo.UserID = "sa";
connectionInfo.Password = "";
string reportPath = Server.MapPath("NorthwindCustomers.rpt");
crystalReportViewer.ReportSource = reportPath;
SetDBLogonForReport(connectionInfo);
}
private void Page_Init(object sender, EventArgs e)
{
ConfigureCrystalReports();
}
private void SetDBLogonForReport(ConnectionInfo connectionInfo)
{
TableLogOnInfos tableLogOnInfos = crystalReportViewer.LogOnInfo;
foreach (TableLogOnInfo tableLogOnInfo in tableLogOnInfos)
{
tableLogOnInfo.ConnectionInfo = connectionInfo;
}
}
//常用属性
CrystalReportViewer1.HasToggleGroupTreeButton = true;//显示或隐藏工具栏上组树按钮
CrystalReportViewer1.HasExportButton = true;//显示或隐藏工具栏上导出按钮
CrystalReportViewer1.HasPrintButton = true;//显示或隐藏工具栏上打印按钮
CrystalReportViewer1.HasViewList = true;//显示或隐藏工具栏上视图列表(主报表)
CrystalReportViewer1.HasDrillUpButton = true;//获取或设置浅化按钮可见性(向上)
CrystalReportViewer1.HasPageNavigationButtons = true;//显示或隐藏工具栏上导航按钮
CrystalReportViewer1.HasGotoPageButton = true;//显示或隐藏工具栏上跳转按钮
CrystalReportViewer1.HasSearchButton = true;//显示或隐藏工具栏上搜索按钮
CrystalReportViewer1.HasZoomFactorList = true;//显示或隐藏工具栏上缩放按钮
CrystalReportViewer1.HasCrystalLogo = true;//显示或隐藏工具栏上LOGO
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"));//缩放
2、登陆验证
private void ConfigureCrystalReports()
{
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = ".";
connectionInfo.DatabaseName = "Northwind";
connectionInfo.UserID = "sa";
connectionInfo.Password = "";
string reportPath = Server.MapPath("NorthwindCustomers.rpt");
crystalReportViewer.ReportSource = reportPath;
SetDBLogonForReport(connectionInfo);
}
private void Page_Init(object sender, EventArgs e)
{
ConfigureCrystalReports();
}
private void SetDBLogonForReport(ConnectionInfo connectionInfo)
{
TableLogOnInfos tableLogOnInfos = crystalReportViewer.LogOnInfo;
foreach (TableLogOnInfo tableLogOnInfo in tableLogOnInfos)
{
tableLogOnInfo.ConnectionInfo = connectionInfo;
}
}
相关文章推荐
- 水晶报表的宽度调整方法(设计器、代码调整、rpt文件属性)
- 水晶报表的宽度调整方法(设计器、代码调整、rpt文件属性)
- 我常用的提高水晶报表访问速度方法一
- [转]水晶报表的宽度调整方法(设计器、代码调整、rpt文件属性)
- 我常用的提高水晶报表访问速度方法一
- 水晶报表-在以下方法或属性之间的调用不明确
- 水晶报表的宽度调整方法(设计器、代码调整、rpt文件属性)
- 水晶报表的宽度调整方法(设计器、代码调整、rpt文件属性)
- 水晶报表的属性和方法
- js的Prototype属性 解释及常用方法
- 在 Web 上打印水晶报表的四种方法
- iPone应用开发 UIView 常用属性和方法
- VB程序打印水晶报表的典型方法1
- 课后作业(五)String对象的常用属性和方法
- 数组的常用属性和方法
- 固定水晶报表每页显示的行数两种方法
- JS教程:String对象及其常用属性以及方法
- UIDatePicker应用 常用属性和方法
- 水晶报表图表出现红叉叉的解决方法
- javascript内置对象常用属性和方法(笔记一)