fastreport中显示两个数据集
最近由于业务需要使用FastReport打印两个表,可以用ROW DATASOURCE只能打一个表,
想了很久都没找到解决办法。
最后发现添加两个Child子报表,再在子报表里添加TABLE就OK了!
再给TABLE里绑定数据就OK了!
绑定方法如下:
1、给TABLE添加一个事件
2、
- private void Table1_ManualBuild(object sender, EventArgs e)
- {
- // get the data source by its name
- DataSourceBase rowData = Report.GetDataSource("Products");
- // init the data source
- rowData.Init();
- // print the first table row - it is a header
- Table1.PrintRow(0);
- // each PrintRow call must be followed by either PrintColumn or PrintColumns call
- // to print cells on the row
- Table1.PrintColumns();
- // now enumerate the data source and print the table body
- while (rowData.HasMoreRows)
- {
- // print the table body
- Table1.PrintRow(1);
- Table1.PrintColumns();
- // go next data source row
- rowData.Next();
- }
- // print the last table row - it is a footer
- Table1.PrintRow(2);
- Table1.PrintColumns();
- }
============ 欢迎各位老板打赏~ ===========
与本文相关的文章
- · FastReport同时加载两种不同的报表
- · fastreport打印时弹出选择打印机
- · FastReport打印两个表
- · .NETCORE 依赖注入服务生命周期
- · asp.net zero改mysql
- · .NET5面试汇总
- · .Net连接Mysql数据库的Convert Zero Datetime日期问题
- · vue使用element-ui中的Message 、MessageBox 、Notification
- · Asp.Net Core Filter 深入浅出的那些事-AOP
- · docker单节点启动consul
- · .NET Core使用Nlog记录日志
- · .netcore3返回JOSN首字母大写