EjunGrid列印控制項的使用

來源:互聯網
上載者:User
1. 如何只列印表格某一範圍的內容
   EjunGridPrinter可以只列印表格中某一指定範圍內的內容,通過設定PrintBounds屬性實現
   PrintBounds.TopRow   指定列印範圍的起始行
              .LeftCol  指定列印範圍的起始列
              .RowCount 指定列印的行數 預設值是-1, 表示列印所有行
              .ColCount 指定列印的列數 預設值是-1, 表示列印所有列
                 

2. 如何列印每頁都出現的標題列和標題列
   
   可以指定表格的某些行和某些列每頁都列印,適合列印標題行和標題列  
   PrintBounds.TitleRows 指定從列印範圍起始行開始的數行為標題列,每頁都列印
   PrintBounds.TitleCols 指定從列印範圍起始行開始的數列為標題列,每頁都列印

3. 如何自動按比例調整列款,使表格剛好佔滿頁面寬度
   
   EjunGridPrinter預設情況下是根據頁面寬度自動橫向分頁,當指定
   FitGridToPageWidth := True 時將不會自動橫向分頁,而是調整每一列的寬度,
   使表格剛好適應頁面寬度

4. 是否可以插入分頁符
   
   可以,Grid.Rows[xx].PageBreak := True

5. 是否能指定每頁列印的行數或者列數
   可以,指定PageColCount, PageRowCount即可

6. 能否實現如下格式的頁首頁尾
 
  ------------------------------------------------------------------------
                                xx報表

                                                                編號:xxx
   建設單位:xxxx                                               日期:  
   工程名稱:xxxx                                               第 1 頁 共 5 頁  

   ...

   可以, EjunGrid列印控制項可以指定頁首頁尾每一個條目的位置,頁首頁尾地區可以被劃分
   成虛擬表格,可以指定每一條目所屬的行列座標,還可以指定對齊,要實現如上效果
   的頁首,以下代碼可以實現

 // 設定報表標題
  GridPrinter.ReportTitle.Caption := ’xx報表’;
  GridPrinter.ReportTitle.Font.Size := 16;
  GridPrinter.ReportTitle.Font.Style := [fsBold];
  // 設定紙張為橫向列印
  GridPrinter.Orientation := poLandscape;
  with GridPrinter.PageHeader.Add do
  begin
    Caption := ’編號:’;
    Align := caRight;
    // 這裡的行列值和Grid的行列值沒有關係,而是將頁首劃分成虛擬表格的行列座標  
    Row := 0;
    Col := 2;
    Font := Grid.Font;
  end;
  with GridPrinter.PageHeader.Add do
  begin
    Caption := ’日期&[date]’;
    Align := caRight;
    Row := 1;
    Col := 2;
    Font := Grid.Font;
  end;
  with GridPrinter.PageHeader.Add do
  begin
    Caption := ’第&[Page]頁 共&[Pages]頁’;
    Align := caRight;
    Row := 2;
    Col := 2;
    Font := Grid.Font;
  end;
  with GridPrinter.PageHeader.Add do
  begin
    Caption := ’建設單位: ’  ;
    Align := caLeft;
    Row := 1;
    Col := 0;
    Font := Grid.Font;
  end;
  with GridPrinter.PageHeader.Add do
  begin
    Caption := ’工程名稱: ’  ;
    Align := caLeft;
    Row := 2;
    Col := 0;
    Font := Grid.Font;
  end;

 

列印片: http://www.ejun.cn/ejungrid/images/report1.jpg
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.