FastReport打印table


經過驗證是對的。

table第一行添加標題,也就是拖過來的文本label,第二行開始綁定數據源的字段。

先設計報表的靜態部分,再用代碼注冊數據源,然后設計,添加注冊的數據源,綁定字段。

1            
2             var report = new Report();
3             report.Load(ProTaskReport);
4             report.RegisterData(new [] {header}, "header");
5             report.RegisterData(body, "body");
6             report.RegisterData(sum, "sum");
7             //report.Design();
8             report.Print();

在報表內添加table的print行。

 1 private void Table2_ManualBuild(object sender, EventArgs e)
 2     {
 3       DataSourceBase body = Report.GetDataSource("sum");
 4       body.Init();
 5       Table2.PrintRow(0);
 6       Table2.PrintColumns();                       
 7       while(body.HasMoreRows){
 8         Table2.PrintRow(1);
 9         Table2.PrintColumns();
10         body.Next();  
11       }
12     }

 2017-5-17 補充

其實這樣做沒必要,可以將數據部分寫在data body里面,綁定數據源字段即可。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM