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打印两个表
- · The instance of entity type ‘Customer’ cannot be tracked because another instance with the same key value for {‘Id’} is already being tracked.
- · .NET8实时更新nginx ip地址归属地
- · 解决.NET Blazor子组件不刷新问题
- · .NET8如何在普通类库中引用 Microsoft.AspNetCore
- · .NET8 Mysql SSL error
- · ASP.NET Core MVC的Razor视图渲染中文乱码的问题
- · .NETCORE 依赖注入服务生命周期
- · asp.net zero改mysql
- · .NET5面试汇总
