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

📄 fcode.pas

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

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, StdCtrls, Buttons, Sctbtn, Sctvar, Sctrep, ExtCtrls, DB,
  DBTables, sctctrl, DBCtrls, AcePage;

type
  TformCode = class(TForm)
    biolife: TTable;
    DataSource1: TDataSource;
    ReportHeaderBand: TSctBand;
    ReportHeaderBandlevel: TSctLevel;
    PageHeaderBand: TSctBand;
    PageHeaderBandlevel: TSctLevel;
    DetailBand: TSctBand;
    DetailBandlevel: TSctLevel;
    PageFooterBand: TSctBand;
    PageFooterBandlevel: TSctLevel;
    ReportFooterBand: TSctBand;
    ReportFooterBandlevel: TSctLevel;
    ReportPage: TSctGrouppage;
    SctReport1: TSctReport;
    svarDateTime: TSctDateTimeVar;
    svarPage: TSctPageVar;
    DataSourceGuide: TSctDataSourceGuide;
    biolifeSpeciesNo: TFloatField;
    biolifeCategory2: TStringField;
    biolifeCommon_Name2: TStringField;
    biolifeSpeciesName: TStringField;
    biolifeLengthcm: TFloatField;
    biolifeLength_In2: TFloatField;
    biolifeNotes2: TMemoField;
    biolifeGraphic2: TGraphicField;
    procedure SctReport1BeforePrint(report: TSctReport);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  formCode: TformCode;

implementation

uses sctutil;

{$R *.DFM}

procedure TformCode.SctReport1BeforePrint(report: TSctReport);
var
  lb: TSctLabel;
  v: TSctDbVar;
begin
  { These components will get deleted automatically my the form
    when it is destroyed.  You can set any of the bands properties
    that you normally can in the object inspector here. Remember to
    set the band and label stretch properties to true if you are
    printing memos.  If you need totals, create total variables on
    the fields that you may need visually at design time. }

  { When generating columns be sure to do it based on the PixelsPerInch
    property of the report.  If you do not do this your reports will
    not show up correctly if you have users that switch between large
    and small fonts, 96ppi and 120ppi.  The report saves the ppi of the
    screen when it is created so that I can properly scale the report
    output for different resolutions. }

  { Make sure you use the PageSetup property of the TSctGroupPage
    (report.page.pagesetup) component to get the dimensions of the output.
    This will help you use the maximum space available on the paper. }

  with TSctGroupPage(report.page) do
  begin
    PageHead.BorderType := btSingle;
    PageHead.Height := 25;

    lb := TSctTextLabel.Create(self);
    with TSctTextLabel(lb) do
    begin
      { you have to set the parent to one of the bands.  Here
        I reference a property on the TSctGroupPage component
        that contains a reference to the page header bands. If
        you want to put a label on a band that you have created
        you can just refer to the band directly by its name }
      Parent := PageHead;
      Caption := 'Common Name';
      AutoSize := False;
      left := 10;
      top := 0;
      width := 100;
      height := 25;
      Font.Name := 'Arial';
      Font.Size := 15;
    end;

    { if the variable name is not set before the parent is set an exception
      is raised.  I'm not sure why yet.  The Parent must be set to the
      reportpage (TSctGroupPage component) so the it can add it to an
      internal list.  This is needed for initialization and updates and so
      that the report knows which variables belong to it if more than one
      report is on the same form.
      UpdateLevel must be set so that the report knows when to update the
      data in the variable.  In this case it is the delail level. }

    { It is probably easier to create variables at design time since it is
      more automatic. }

    v := TSctDbVar.Create(self);
    SctAutoSetComponentName(v, v.classname, True);
    v.Parent := ReportPage;
    v.DataSource := DataSource1;
    v.DataField := 'Common_Name';
    v.updatelevel := DetailBandLevel;

    Detail.BorderType := btSingle;
    Detail.Height := 20;

    lb := TSctVarLabel.Create(Self);
    with TSctVarLabel(lb) do
    begin
      Parent := Detail;
      Variable := v;
      left := 10;
      top := 2;
      width := 100;
      AutoSize := False;
      height := 15;
      BorderType := btSingle;
      ClipType := ctClip;
      Font.Name := 'Arial';
      Font.Size := 8;
    end;
  end;
end;

end.

⌨️ 快捷键说明

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