⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.pas

📁 suite component ace report
💻 PAS
字号:
unit Unit1;

interface

uses
  Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons, SctBtn, SctCtrl, SctVar, AcePage, SctRep, Db,
  DBTables, ExtCtrls;

type
  TForm1 = class(TForm)
    SctReport1: TSctReport;
    ReportPage: TSctGrouppage;
    ReportHeaderBand: TSctBand;
    ReportHeaderBandlevel: TSctLevel;
    PageHeaderBand: TSctBand;
    PageHeaderBandlevel: TSctLevel;
    DetailBand: TSctBand;
    DetailBandlevel: TSctLevel;
    PageFooterBand: TSctBand;
    PageFooterBandlevel: TSctLevel;
    ReportFooterBand: TSctBand;
    ReportFooterBandlevel: TSctLevel;
    DataSource1: TDataSource;
    Table1: TTable;
    svarDateTime: TSctDateTimeVar;
    svarPage: TSctPageVar;
    DataSourceGuide: TSctDataSourceGuide;
    table1CustNo: TSctDBVar;
    table1Company: TSctDBVar;
    table1Addr1: TSctDBVar;
    table1Addr2: TSctDBVar;
    table1City: TSctDBVar;
    table1State: TSctDBVar;
    table1Zip: TSctDBVar;
    table1Country: TSctDBVar;
    table1Phone: TSctDBVar;
    table1FAX: TSctDBVar;
    table1TaxRate: TSctDBVar;
    table1Contact: TSctDBVar;
    table1LastInvoiceDate: TSctDBVar;
    ExprAddress: TSctExprVar;
    varlabel: TSctvarlabel;
    SctReportButton1: TSctReportButton;
    procedure ExprAddressGetData(oVar: TSctVar);
    procedure ReportPageBeforeNewPage(Page: TSctPage;
      var DoNewPage: Boolean);
    procedure SctReport1BeforePrint(Report: TSctReport);
    procedure DetailBandBeforePrint(Band: TSctBand);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation
var
  MarkYPos, nCols, nColWidth, nCurrCol: Integer;

{$R *.DFM}

procedure TForm1.ExprAddressGetData(oVar: TSctVar);
begin
  oVar.AsString := table1Company.AsString +   #10
                  +table1Addr1.AsString + #10
                  +table1Addr2.AsString + #10
                  +table1City.AsString + ', ' + table1State.AsString
                  +' ' +table1Zip.AsString + #10
                  +table1Country.AsString;
end;

procedure TForm1.ReportPageBeforeNewPage(Page: TSctPage;
  var DoNewPage: Boolean);
begin
  Inc(nCurrCol);
  DoNewPage := (nCurrCol >= nCols);
  if DoNewPage then nCurrCol := 0 else Page.yPos := MarkYPos;

  Page.xPos := Round(Page.PageSetup.LeftMargin * Page.PixelsPerInch)
              + (nCurrCol * nColWidth);
end;

procedure TForm1.SctReport1BeforePrint(Report: TSctReport);
begin
  nCols := 3;
  nColWidth := Report.Page.PageWidth div nCols;
  nCurrCol := 0;
  MarkYPos := -1;
end;

procedure TForm1.DetailBandBeforePrint(Band: TSctBand);
begin
  if MarkYPos = -1 then MarkYPos :=  Band.Page.YPos;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -