一直以来,锐浪报表做的不错,尤其是适用于国内的状况。加上不是很满意rdlc的功能,查遍网络,很少有这方面的介绍。所以整理常用功能,以备使用。水平有限,大家根据自身情况来学习。
一、 套打技巧
(1) 扫描原件电子版作为报表背景
(2) 在报表上面依据背景画出控件位置
(3) 根据字段可以设计数据库和报表的连接进行自动大批量打印
二、 多表头
详见ppt
三、 锐浪报表使用(单数据连接)
数据连接有两种模式(推模式、拉模式),推模式就是由程序代码把连接字符串、SQL语句推送给报表;拉模式则是在明细网格中根据填好的连接字符串、SQL语句由报表自身自主查询(不建议,连接语句包含在报表中,不太安全)。
private GridppReportReport = new GridppReport();//1.定义一个新报表
public voidshowreport()
{
//2.载入报表模板数据
//Report.LoadFromFile(GridppReportDemo.Utility.GetReportTemplatePath()+ "program\ParamQuerySQL2.grf");
Report.LoadFromFile(Application.StartupPath+ "\1.grf");
//3.设置与数据源的连接串,因为在设计时指定的数据库路径是绝对路径。
Report.DetailGrid.Recordset.ConnectionString = "Provider=SQLOLEDB.1;Password=xxxxxx;PersistSecurity Info=True;User ID= xxxxxx;Initial Catalog=ry_powder;DataSource=192.168.8.18;Use Procedure for Prepare=1;Auto Translate=True;PacketSize=4096;Workstation ID=UNCLE13;Use Encryption for Data=False;Tag with columncollation when possible=False";
//4.连接报表取数事件
Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(MyReport);
//5.设定查询显示器要显示的报表
axGRPrintViewer1.Report = Report;
}
private voidMyReport()//报表查询条件
{
string startdate = dateTimePicker1.Value.ToString("yy-MM-dd 0:00:00");
string enddate = dateTimePicker2.Value.ToString("yy-MM-dd 23:59:59");
string SQL = "SELECT* FROM production_material_lose WHERE unit= + comboBox1.Text + ANDunit_2 = + comboBox2.Text + AND materialtype = + comboBox3.Text + AND typedetail = + comboBox4.Text + and uploaddate >= +startdate + and uploaddate