我知道QUICKREPORT控件可以获取当前页的number(用sysdata控件即可),但报表总的页数(count)怎么获取??

解决方案 »

  1.   

    FPageCount:=quickRep1.Printer.PageCount;
      

  2.   

    add:
    your quickRep1 need prepare before use the sentence up.
      

  3.   

    Count:=quickRep1.Printer.PageCount;
      

  4.   

    我用为什么就不可以呢?
    我在quickRep1上加了一个lable ,让lable.caption:=quickRep1.Printer.PageCount;
    就是不对啊。第一页出来1,第二页出来2。
    这行代码应该在什么事件里面填呢?
      

  5.   

    .........
      private
        { Private declarations }
    //定義
      FPageCount:integer;
    .........
    //賦值
    qry.close;
    qry.sql.text:='....';//報表中獲得數據的語句
    qry.open;
    QuickRep1.prepare;
    FPageCount:=QuickRep1.Printer.PageCount;
    .........
    放置一個QrSysData在需要顯示的地方,設置其Data屬性為qrsPageNumber
    然後在它的onprint事件裡面,加上代碼:
      Value:=Value+' of '+IntToStr(FPageCount);
    就 OK