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

📄 cgridrep.pas

📁 TGridRep Component (1.0) -- by WeiYF, 2000.06.15 该组件实现网格模式的QuickRpt报表打印组件
💻 PAS
📖 第 1 页 / 共 3 页
字号:
        WordWrap := True;
        Font := FPageHeaderFont;
      end;
      FPageNoLabel := TQRLabel.Create(self);
      with FPageNoLabel do begin
        Parent := PageHeaderBand;
        Left := 0;        Top := 8;
        Width := 560;     Height := 16;
        Frame.Color := clBlack;
        Frame.DrawTop := False;
        Frame.DrawBottom := False;
        Frame.DrawLeft := False;
        Frame.DrawRight := False;
        //Size.Height := 4.50;
        //Size.Width := 15.35;
        Alignment := taRightJustify;
        AlignToBand := True;//False;
        AutoSize := True;
        AutoStretch := False;
        Caption := 'PageNo Label';
        Color := clWhite;
        Transparent := False;
        WordWrap := True;
        Font := FPageNoFont;
      end;
      Height := FPageHeaderLabel.Height+16;
    end;
    TitleBand := TQRBand.Create(self);
    with TitleBand do begin
      Parent := QR;
      Left := 0;      Top := 62;
      Width := iPageWidth;    Height := 32;
      Frame.Color := clBlack;
      Frame.DrawTop := False;
      Frame.DrawBottom := False;
      Frame.DrawLeft := False;
      Frame.DrawRight := False;
      AlignToBottom := False;
      Color := clWhite;
      ForceNewColumn := False;
      ForceNewPage := False;
      //Size.Height := 10.58;
      //Size.Width := 189.97;
      BandType := rbTitle;
      FPageTitleLabel := TQRLabel.Create(self);
      with FPageTitleLabel do begin
        Parent := TitleBand;
        Left := 0;        Top := 8;
        Width := 702;     Height := 20;
        Frame.Color := clBlack;
        Frame.DrawTop := False;
        Frame.DrawBottom := False;
        Frame.DrawLeft := False;
        Frame.DrawRight := False;
        //Size.Height := 4.50;
        //Size.Width := 15.35;
        Alignment := taCenter;
        AlignToBand := True;//False;
        AutoSize := True;
        AutoStretch := False;
        Caption := 'Title Label';
        Color := clWhite;
        Transparent := False;
        WordWrap := True;
        Font := FPageTitleFont;
      end;
      Height := FPageTitleLabel.Height+16;
    end;
    ColumnHeaderBand := TQRBand.Create(self);
    with ColumnHeaderBand do begin
      Parent := QR;
      Left := 0;           Top := 194;
      Width := iPageWidth;  Height := 20;
      Frame.Color := clBlack;
      Frame.DrawTop := bGrid;//False;
      Frame.DrawBottom := bGrid;//False;
      Frame.DrawLeft := bGrid;//False;
      Frame.DrawRight := bGrid;//False;
      AlignToBottom := False;
      Color := clWhite;
      ForceNewColumn := False;
      ForceNewPage := False;
      //Size.Height := 10.58;
      //Size.Width := 189.97;
      BandType := rbColumnHeader;

      for i:=0 to MAX_COL_NUM-1 do begin
        FColHeaderLines[i] := TQRShape.Create(self);
        with FColHeaderLines[i] do begin
          Parent := ColumnHeaderBand;
          Left := i*w;    Top :=  0;
          Width := 1;     Height := ColumnHeaderBand.Height;
          Frame.Color := clBlack;
          Frame.DrawTop := False;
          Frame.DrawBottom := False;
          Frame.DrawLeft := False;
          Frame.DrawRight := False;
          Shape := qrsVertLine;
        end;
      end;
      for i:=0 to MAX_COL_NUM-1 do begin
        FColHeaderLabels[i] := TQRLabel.Create(self);
        with FColHeaderLabels[i] do begin
          Parent := ColumnHeaderBand;
          Left := i*w+COL_SID_SIZ;    Top := ROW_TOP_SIZ;
          Width := w-COL_SID_SIZ;   Height := 20;
          Frame.Color := clBlack;
          Frame.DrawTop := False;//
          Frame.DrawBottom := False;
          Frame.DrawLeft := False;
          Frame.DrawRight := False;
          //Size.Height := 4.50;
          //Size.Width := 15.35;
          Alignment := taLeftJustify;
          AlignToBand := False;
          AutoSize := True;
          AutoStretch := False;
          Caption := Chr(i+Ord('@'));
          Color := clWhite;
          Transparent := False;
          WordWrap := True;
          Font := FColHeaderFont;
        end;
      end;
      Height := FColHeaderLabels[0].Height+8;
    end;
    ColDetailBand := TQRBand.Create(self);
    with ColDetailBand do begin
      Parent := QR;
      Left := 0;           Top := 114;
      Width := iPageWidth;  Height := 20;//32;
      Frame.Color := clBlack;
      Frame.DrawTop := False;
      Frame.DrawBottom := False;//True;//False;
      Frame.DrawLeft := bGrid;//False;
      Frame.DrawRight := bGrid;//False;
      AlignToBottom := False;
      Color := clWhite;
      ForceNewColumn := False;
      ForceNewPage := False;
      //Size.Height := 10.58;
      //Size.Width := 189.97;
      BandType := rbDetail;
      for i:=0 to MAX_COL_NUM-1 do begin
        FColDetailLines[i] := TQRShape.Create(self);
        with FColDetailLines[i] do begin
          Parent := ColDetailBand;
          Left := i*w;    Top := 0;
          Width := 1;     Height := ColDetailBand.Height;
          Frame.Color := clBlack;
          Frame.DrawTop := False;
          Frame.DrawBottom := False;
          Frame.DrawLeft := False;
          Frame.DrawRight := False;
          Shape := qrsVertLine;
        end;
      end;
      FColDetailBottomLine := TQRShape.Create(self);
      with FColDetailBottomLine do begin
        Parent := ColDetailBand;
        Left := 0;    Top :=  ColDetailBand.Height;
        Width := ColDetailBand.Width;     Height := 1;
        Frame.Color := clBlack;
        Frame.DrawTop := False;
        Frame.DrawBottom := False;
        Frame.DrawLeft := False;
        Frame.DrawRight := False;
        Shape := qrsHorLine;
      end;
      for i:=0 to MAX_COL_NUM-1 do begin
        FColDetailLabels[i] := TQRLabel.Create(self);
        with FColDetailLabels[i] do begin
          Parent := ColDetailBand;
          Left := FColHeaderLabels[i].Left;       Top := ROW_TOP_SIZ;//8
          Width := FColHeaderLabels[i].Width;     Height := 20;//16
          Frame.Color := clBlack;
          Frame.DrawTop := False;
          Frame.DrawBottom := False;
          Frame.DrawLeft := False;
          Frame.DrawRight := False;
          //Size.Height := 4.50;
          //Size.Width := 15.35;
          Alignment := taLeftJustify;
          AlignToBand := False;
          AutoSize := True;
          AutoStretch := False;
          Caption := IntToStr(i);
          Color := clWhite;
          Transparent := False;
          WordWrap := True;
          Font := FColDetailFonts[i];
        end;
      end;
      Height := FColDetailLabels[0].Height+8;
    end;
    PageFooterBand := TQRBand.Create(self);
    with PageFooterBand do begin
      Parent := QR;
      Left := 38;      Top := 134;
      Width := iPageWidth;    Height := 24;
      Frame.Color := clBlack;
      Frame.DrawTop := True;//False;
      Frame.DrawBottom := False;
      Frame.DrawLeft := False;
      Frame.DrawRight := False;
      AlignToBottom := False;
      Color := clWhite;
      ForceNewColumn := False;
      ForceNewPage := False;
      //Size.Height := 10.58;
      //Size.Width := 189.97;
      BandType := rbPageFooter;
      FPageFooterLabel := TQRLabel.Create(self);
      with FPageFooterLabel do begin
        Parent := PageFooterBand;
        Left := 8;        Top := 8;
        Width := 702;     Height := 16;
        Frame.Color := clBlack;
        Frame.DrawTop := False;
        Frame.DrawBottom := False;
        Frame.DrawLeft := False;
        Frame.DrawRight := False;
        //Size.Height := 4.50;
        //Size.Width := 15.35;
        Alignment := taLeftJustify;
        AlignToBand := True;//False;
        AutoSize := True;
        AutoStretch := False;
        Caption := '广州市诚毅科技软件开发有限公司 魏延峰 制表';
        Color := clWhite;
        Transparent := False;
        WordWrap := True;
        Font := FPageFooterFont;
      end;        //
      FPageTimeLabel := TQRLabel.Create(self);
      with FPageTimeLabel do begin
        Parent := PageFooterBand;
        Left := 0;        Top := 8;
        Width := 560;     Height := 16;
        Frame.Color := clBlack;
        Frame.DrawTop := False;
        Frame.DrawBottom := False;
        Frame.DrawLeft := False;
        Frame.DrawRight := False;
        //Size.Height := 4.50;
        //Size.Width := 15.35;
        Alignment := taRightJustify;
        AlignToBand := True;//False;
        AutoSize := True;
        AutoStretch := False;
        Caption := 'PageNo Label';
        Color := clWhite;
        Transparent := False;
        WordWrap := True;
        Font := FPageNoFont;
      end;
      Height := FPageFooterLabel.Height+16;
    end;
  end;
  iRowCount := 0;
  iPageCount := 0;
  SetTaskTitle('网格打印任务');
end;

destructor TGridRep.Destroy;
var i: integer;
begin
  FPageHeaderFont.Free;
  FPageTitleFont.Free;
  FColHeaderFont.Free;
  for i:=0 to MAX_COL_NUM-1 do FColDetailFonts[i].Free;
  FPageFooterFont.Free;
  FPageNoFont.Free;

  FPageHeaderLabel.Free;
  FPageNoLabel.Free;
  FPageTitleLabel.Free;
  for i:=0 to MAX_COL_NUM-1 do FColHeaderLabels[i].Free;
  for i:=0 to MAX_COL_NUM-1 do FColDetailLabels[i].Free;
  for i:=0 to MAX_COL_NUM-1 do FColHeaderLines[i].Free;
  for i:=0 to MAX_COL_NUM-1 do FColDetailLines[i].Free;
  FColDetailBottomLine.Free;
  FPageFooterLabel.Free;
  FPageTimeLabel.Free;

  TitleBand.Free;
  ColumnHeaderBand.Free;
  ColDetailBand.Free;
  PageFooterBand.Free;

  QR.Free;
  inherited Destroy;
end;

function TGridRep.GetTaskTitle: string;
begin
  result := QR.ReportTitle;
end;

procedure TGridRep.SetTaskTitle(value: string);
begin
  QR.ReportTitle := value;
end;

function TGridRep.GetPageTitle: string;
begin
  result := FPageTitleLabel.Caption;
end;

procedure TGridRep.SetPageTitle(value: string);
begin
  if (value<>FPageTitleLabel.Caption) then FPageTitleLabel.Caption := value;
end;

function TGridRep.GetColHeaders(index: integer): string;
begin
  result := FColHeaderLabels[index].Caption;
end;

procedure TGridRep.SetColHeaders(index: integer; value: string);
begin
  if (value<>FColHeaderLabels[index].Caption) then
    FColHeaderLabels[index].Caption := value;
end;

function TGridRep.GetPageHeader: string;
begin
  result := FPageHeaderLabel.Caption;
end;

procedure TGridRep.SetPageHeader(value: string);
begin
  if (value<>FPageHeaderLabel.Caption) then FPageHeaderLabel.Caption := value;
end;

function TGridRep.GetPageFooter: string;
begin
  result := FPageFooterLabel.Caption;
end;

⌨️ 快捷键说明

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