zoukankan      html  css  js  c++  java
  • 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里面,绑定数据源字段即可。

  • 相关阅读:
    异常及throw、与throws的介绍
    js数组
    正则表达式
    Date对象及toString方法
    js中函数与对象的使用
    js细节
    JavaScript介绍
    浮动、定位
    css背景样式
    盒子模型
  • 原文地址:https://www.cnblogs.com/jonney-wang/p/6844943.html
Copyright © 2011-2022 走看看