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

📄 aceoview.pas

📁 suite component ace report
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit AceOView;

{ ----------------------------------------------------------------
  Ace Reporter
  Copyright 1995-1998 SCT Associates, Inc.
  Written by Kevin Maher, Steve Tyrakowski
  ---------------------------------------------------------------- }

interface
{$I ace.inc}

uses
{$ifdef WIN32}
  Windows,
{$else}
  winprocs,wintypes,
{$endif}
   Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  SctVar, ExtCtrls, SctRep, SctCtrl, sctdata,psetup, aceutil,acesetup,
     aceprev, acetypes, sctutil, Menus, aceout;

type
  TAceOverview = 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;
    svarDateTime: TSctDateTimeVar;
    svarPage: TSctPageVar;
    BandName: TSctExprVar;
    varlabel: TSctvarlabel;
    Labels: TSctSubDataBand;
    Labelslevel: TSctLevel;
    LabelName: TSctExprVar;
    varlabel1: TSctvarlabel;
    Groups: TSctSubBand;
    GroupName: TSctExprVar;
    varlabel2: TSctvarlabel;
    TextLabel2: TSctTextLabel;
    BandHeight: TSctExprVar;
    Sctvarlabel1: TSctvarlabel;
    BandColor: TSctExprVar;
    Sctvarlabel2: TSctvarlabel;
    LabelColor: TSctExprVar;
    BandBorder: TSctExprVar;
    Sctvarlabel3: TSctvarlabel;
    SctTextLabel1: TSctTextLabel;
    SctTextLabel2: TSctTextLabel;
    SctTextLabel3: TSctTextLabel;
    SctTextLabel4: TSctTextLabel;
    Sctvarlabel4: TSctvarlabel;
    ReportDesc: TSctExprVar;
    SctTextLabel5: TSctTextLabel;
    Sctvarlabel5: TSctvarlabel;
    SctTotalvarLabel1: TSctTotalvarLabel;
    TotalBands: TSctTotalvar;
    SctTextLabel8: TSctTextLabel;
    LabelTop: TSctExprVar;
    LabelLeft: TSctExprVar;
    LabelHeight: TSctExprVar;
    LabelWidth: TSctExprVar;
    Sctvarlabel6: TSctvarlabel;
    Sctvarlabel7: TSctvarlabel;
    Sctvarlabel8: TSctvarlabel;
    Sctvarlabel9: TSctvarlabel;
    BandVisible: TSctExprVar;
    BandRepeat: TSctExprVar;
    BandNewPage: TSctExprVar;
    BandStretch: TSctExprVar;
    SctCheckLabel1: TSctCheckLabel;
    SctTextLabel12: TSctTextLabel;
    SctTextLabel13: TSctTextLabel;
    SctCheckLabel2: TSctCheckLabel;
    SctTextLabel14: TSctTextLabel;
    SctCheckLabel3: TSctCheckLabel;
    SctTextLabel15: TSctTextLabel;
    SctCheckLabel4: TSctCheckLabel;
    ReportOwner: TSctExprVar;
    Sctvarlabel10: TSctvarlabel;
    SctTextLabel16: TSctTextLabel;
    Setup: TSctSubBand;
    SctTextLabel17: TSctTextLabel;
    SctTextLabel18: TSctTextLabel;
    SctTextLabel19: TSctTextLabel;
    SctTextLabel20: TSctTextLabel;
    SctTextLabel21: TSctTextLabel;
    Sctvarlabel11: TSctvarlabel;
    Sctvarlabel12: TSctvarlabel;
    Sctvarlabel13: TSctvarlabel;
    Sctvarlabel14: TSctvarlabel;
    MarginRight: TSctExprVar;
    MarginBottom: TSctExprVar;
    MarginTop: TSctExprVar;
    MarginLeft: TSctExprVar;
    SctTextLabel22: TSctTextLabel;
    Sctvarlabel15: TSctvarlabel;
    PaperSource: TSctExprVar;
    PaperSize: TSctExprVar;
    PrintDest: TSctExprVar;
    PrintDuplex: TSctExprVar;
    PrintCopies: TSctExprVar;
    varlabel3: TSctvarlabel;
    varlabel4: TSctvarlabel;
    varlabel5: TSctvarlabel;
    varlabel6: TSctvarlabel;
    varlabel7: TSctvarlabel;
    SctTextLabel23: TSctTextLabel;
    SctTextLabel24: TSctTextLabel;
    SctTextLabel25: TSctTextLabel;
    PaperHeight: TSctExprVar;
    PaperWidth: TSctExprVar;
    varlabel8: TSctvarlabel;
    varlabel9: TSctvarlabel;
    SctTextLabel26: TSctTextLabel;
    DetailDataSource: TSctExprVar;
    SubDataSource: TSctExprVar;
    varlabel10: TSctvarlabel;
    varlabel11: TSctvarlabel;
    SctTextLabel27: TSctTextLabel;
    SctTextLabel28: TSctTextLabel;
    SctShape7: TSctShape;
    SctTextLabel55: TSctTextLabel;
    SctTextLabel66: TSctTextLabel;
    SctTextLabel67: TSctTextLabel;
    SctTextLabel68: TSctTextLabel;
    SctTextLabel69: TSctTextLabel;
    Sctvarlabel16: TSctvarlabel;
    Sctvarlabel17: TSctvarlabel;
    SctTextLabel29: TSctTextLabel;
    SctTextLabel30: TSctTextLabel;
    Sctvarlabel18: TSctvarlabel;
    AceVersion: TSctExprVar;
    PrintQuality: TSctExprVar;
    PrintTextComp: TSctExprVar;
    PrintUnits: TSctExprVar;
    PrintTTOption: TSctExprVar;
    PrintAdjMargins: TSctExprVar;
    PrintCollated: TSctExprVar;
    PrintColor: TSctExprVar;
    PrintDirect: TSctExprVar;
    PrintOrientation: TSctExprVar;
    PrintFormName: TSctExprVar;
    PrintRangeStart: TSctExprVar;
    PrintRangeEnd: TSctExprVar;
    PreviewFormStyle: TSctExprVar;
    PreviewModal: TSctExprVar;
    PreviewOwner: TSctExprVar;
    PreviewState: TSctExprVar;
    PreviewZoom: TSctExprVar;
    TextLabel: TSctTextLabel;
    varlabel12: TSctvarlabel;
    TextLabel3: TSctTextLabel;
    varlabel13: TSctvarlabel;
    TextLabel4: TSctTextLabel;
    varlabel14: TSctvarlabel;
    TextLabel5: TSctTextLabel;
    SctCheckLabel5: TSctCheckLabel;
    TextLabel6: TSctTextLabel;
    varlabel15: TSctvarlabel;
    TextLabel7: TSctTextLabel;
    varlabel16: TSctvarlabel;
    TextLabel8: TSctTextLabel;
    varlabel17: TSctvarlabel;
    TextLabel9: TSctTextLabel;
    varlabel18: TSctvarlabel;
    TextLabel10: TSctTextLabel;
    varlabel19: TSctvarlabel;
    TextLabel11: TSctTextLabel;
    varlabel20: TSctvarlabel;
    TextLabel12: TSctTextLabel;
    TextLabel13: TSctTextLabel;
    TextLabel14: TSctTextLabel;
    varlabel23: TSctvarlabel;
    TextLabel15: TSctTextLabel;
    SctCheckLabel6: TSctCheckLabel;
    SctCheckLabel8: TSctCheckLabel;
    TextLabel16: TSctTextLabel;
    SctCheckLabel9: TSctCheckLabel;
    TextLabel17: TSctTextLabel;
    SctCheckLabel10: TSctCheckLabel;
    SctTextLabel31: TSctTextLabel;
    SctTextLabel32: TSctTextLabel;
    SctTextLabel33: TSctTextLabel;
    SctShape1: TSctShape;
    SctShape2: TSctShape;
    SctTextLabel10: TSctTextLabel;
    Sctvarlabel19: TSctvarlabel;
    Sctvarlabel20: TSctvarlabel;
    LabelVar: TSctExprVar;
    LabelInfo: TSctExprVar;
    LabelInfo2: TSctExprVar;
    varlabel21: TSctvarlabel;
    LabelFont: TSctExprVar;
    LabelBorder: TSctExprVar;
    varlabel22: TSctvarlabel;
    varlabel24: TSctvarlabel;
    LabelFormat: TSctExprVar;
    varlabel25: TSctvarlabel;
    LabelsFooter: TSctDataFootBand;
    LabelsFooterLevel: TSctLevel;
    TotalLabels: TSctTotalvar;
    DetailBandSub1: TSctSubBand;
    Sctvarlabel21: TSctvarlabel;
    SctTextLabel11: TSctTextLabel;
    TotalvarLabel: TSctTotalvarLabel;
    SctTextLabel34: TSctTextLabel;
    SctTextLabel35: TSctTextLabel;
    SctTextLabel36: TSctTextLabel;
    SctTextLabel37: TSctTextLabel;
    TextLabel1: TSctTextLabel;
    SctTextLabel9: TSctTextLabel;
    SctTextLabel6: TSctTextLabel;
    SctTextLabel7: TSctTextLabel;
    DetailBandSub: TSctSubBand;
    GroupVarName: TSctExprVar;
    varlabel26: TSctvarlabel;
    SctTextLabel38: TSctTextLabel;
    Sctvarlabel22: TSctvarlabel;
    Sctvarlabel23: TSctvarlabel;
    Caption: TSctExprVar;
    Sctvarlabel24: TSctvarlabel;
    Sctvarlabel25: TSctvarlabel;
    LinesVar: TSctExprVar;
    varlabel27: TSctvarlabel;
    BandList: TSctSubDataBand;
    DataLevel: TSctLevel;
    SctCustomLabel1: TSctCustomLabel;
    BandListHeader: TSctDataHeadBand;
    BandListHeaderLevel: TSctLevel;
    Sctvarlabel26: TSctvarlabel;
    BandListFooter: TSctDataFootBand;
    BandListFooterLevel: TSctLevel;
    procedure ReportPageDataStart(Sender: TObject);
    procedure ReportPageDataSkip(Sender: TObject);
    procedure SctReport1BeforePrint(Report: TSctReport);

    procedure LabelsDataStart(Sender: TObject);
    procedure LabelsDataSkip(Sender: TObject);
    procedure filld(df:TSctFormat);
    procedure GroupsPrintWhen(Band: TSctBand; var Result: Boolean);

    procedure ReportPageAfterDataSkip(Page: TSctGrouppage);
    procedure LabelsAfterDataSkip(Band: TSctSubDataBand);
    procedure SetupPrintWhen(Band: TSctBand; var Result: Boolean);
    procedure varlabel11LabelPrintWhen(lb: TSctLabel; var Result: Boolean);
    procedure GetPageSetupVars(PS:TSctPageSetup);
    procedure LabelsAfterPrint(Band: TSctBand);
    procedure DetailBandAfterPrint(Band: TSctBand);
    procedure BandListDataStart(Sender: TObject);
    procedure BandListDataSkip(Sender: TObject);
    procedure SctCustomLabel1Draw(lb: TSctLabel; AceCanvas: TObject;
      Rect: TRect);
    procedure Sctvarlabel26BeforePrint(lb: TSctLabel);
  private
    { Private declarations }
    BandCount, BandSpot: Integer;
    Band: TSctBand;
    BandLabel: TSctLabel;
    LabelCount, LabelSpot: Integer;
    ReportGroup: TSctGroup;
    Spot: Integer;
    procedure DrawBand(AceCanvas: TAceCanvas; Rect: TRect);
  public
    { Public declarations }
    Report: TSctReport;
    GP: TSctGroupPage;
  end;

var
  AceOverview: TAceOverview;

implementation
uses typinfo;

{$R *.DFM}

procedure TAceOverview.SctReport1BeforePrint(Report: TSctReport);
begin
{  GP := TSctGroupPage(Report.Page);}
end;

procedure TAceOverview.ReportPageDataStart(Sender: TObject);
begin
  BandSpot := 0;
  BandCount := GP.Bands.Count;
  { BandCount should always be at least five }
  TSctGroupPage(Sender).DataIsFinished := False;
  Band := TSctBand(GP.Bands[BandSpot]);
  ReportDesc.AsString := GP.Description;
  ReportOwner.AsString := GP.Owner.Name;

  GetPageSetupVars(GP.PageSetup); {Get PageSetup Variables}

  AceVersion.AsString := AceUtil.AceVersion;
  if GP.DataSource <> nil then
    DetailDataSource.AsString := GP.DataSource.Name
  else
    DetailDataSource.AsString := 'Empty';

end;

procedure TAceOverview.ReportPageDataSkip(Sender: TObject);
var
  Spot: Integer;
begin
  Inc(BandSpot);
  if BandSpot < BandCount then
  begin
    Band := TSctBand(GP.Bands[BandSpot]);

    ReportGroup := nil;
    if GP.Groups <> nil then
    begin
      Spot := 0;
      while (ReportGroup = nil) And (Spot < GP.Groups.Count) do
      begin
        if TSctGroup(GP.Groups[Spot]).Header = Band then
            ReportGroup := TSctGroup(GP.Groups[Spot])
        else Inc(Spot);
      end;
    end;


  end else TSctGroupPage(Sender).DataIsFinished := True;
end;


procedure TAceOverview.LabelsDataStart(Sender: TObject);
begin
  LabelSpot := 0;
  if Band.Labels = nil then LabelCount := 0
  else LabelCount := Band.Labels.Count;
  TSctSubDataBand(Sender).DataIsFinished := (LabelCount = 0);
  if LabelCount > 0 then BandLabel := TSctLabel(Band.Labels[LabelSpot]);
end;

procedure TAceOverview.LabelsDataSkip(Sender: TObject);
begin
  Inc(LabelSpot);
  if LabelSpot < LabelCount then
  begin
    BandLabel := TSctLabel(Band.Labels[LabelSpot]);
  end else TSctSubDataBand(Sender).DataIsFinished := True;
end;


procedure TAceOverview.GroupsPrintWhen(Band: TSctBand;
  var Result: Boolean);
begin
  Result := (ReportGroup <> nil);
end;


procedure TAceOverview.ReportPageAfterDataSkip(Page: TSctGrouppage);

begin
   if Band is TSctSubDataBand then
   begin
     if TSctSubDataBand(Band).DataSource <> nil then
       SubDataSource.AsString := TSctSubDataBand(Band).DataSource.Name
     else SubDataSource.AsString := 'Empty';
   end;
   BandName.AsString :=  Band.Name;
   BandStretch.AsBoolean := Band.Stretch;
   BandNewPage.AsBoolean := Band.NewPage;
   BandRepeat.AsBoolean := Band.NewPageRepeat;
   BandVisible.AsBoolean := Band.Visible;
   BandHeight.AsInteger := Band.Height;
   BandBorder.AsString := GetEnumName(TypeInfo(TSctBorderType),Ord(Band.BorderType)){$ifndef WIN32}^{$endif} ;
   BandColor.AsString := ColorToString(Band.Color);
   if ReportGroup = nil then GroupName.AsString := ''
   else begin
     GroupName.AsString := ReportGroup.Name;
     if ReportGroup.Variable = nil then GroupVarName.AsString := 'Not assigned'
     else GroupVarName.AsString := ReportGroup.Variable.Name;
   end;
end;

procedure TAceOverview.filld(df:TSctFormat);
begin
  if Length(df.DisplayFormat) > 0 then
     LabelFormat.AsString := df.DisplayFormat
  else LabelFormat.AsString := GetEnumName(TypeInfo(TFloatFormat),Ord(df.FloatFormat)){$ifndef WIN32}^{$endif}
          + ' ' + IntToStr(df.Width) + ' ' + IntToStr(df.Digits) ;
end;

procedure TAceOverview.LabelsAfterDataSkip(Band: TSctSubDataBand);
begin
   LabelName.AsString := BandLabel.Name;
   LabelColor.AsString := ColorToString(TSctTextLabel(BandLabel).Color);
   LabelTop.AsInteger := BandLabel.Top;
   LabelLeft.AsInteger := BandLabel.Left;
   LabelHeight.AsInteger := BandLabel.Height;
   LabelWidth.AsInteger := BandLabel.Width;
   LabelVar.AsString := '';
   LabelInfo.AsString := '';
   LabelInfo2.AsString := '';
   LabelFont.AsString := '';
   LabelBorder.AsString := '';
   LabelFormat.AsString := '';
   Labels.Stretch := False;

   if BandLabel is TSctShape then
     begin
       LabelVar.AsString := GetEnumName(TypeInfo(TSctShapeType)
          ,Ord(TSctShape(BandLabel).ShapeType)){$ifndef WIN32}^{$endif};
       SctTextLabel24.Caption := 'Shape:';
       SctTextLabel24.Font.Color := clMaroon;
     end;
   if BandLabel is TSctLine then
     begin
       LabelVar.AsString := GetEnumName(TypeInfo(TSctLineType)
          ,Ord(TSctLine(BandLabel).LineType)){$ifndef WIN32}^{$endif};
       SctTextLabel24.Caption := 'Line:';
       SctTextLabel24.Font.Color := clMaroon;
     end;
   if BandLabel is TSctBarCodeLabel then
     begin
       if TSctBarCodeLabel(BandLabel).Variable = nil then
         LabelVar.AsString := 'Not assigned'
       else
         LabelVar.AsString := TSctBarCodeLabel(BandLabel).Variable.Name;
       LabelInfo.AsString := GetEnumName(TypeInfo(TSctBarCodeType)
          ,Ord(TSctBarCodeLabel(BandLabel).BarCodeType)){$ifndef WIN32}^{$endif};
       SctTextLabel24.Caption := 'BarCode:';
       SctTextLabel24.Font.Color := clMaroon;
     end;
   if BandLabel is TSctImageLabel then
     begin
       if TSctImageLabel(BandLabel).Variable = nil then
          LabelVar.AsString := 'Not assigned'
       else LabelVar.AsString := TSctImageLabel(BandLabel).Variable.Name;
       SctTextLabel24.Caption := 'Image:';
       SctTextLabel24.Font.Color := clMaroon;
     end;

   if BandLabel is TSctCheckLabel then
     begin
       if TSctCheckLabel(BandLabel).Variable = nil then

⌨️ 快捷键说明

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