Delphi Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
델파이 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
FreePascal/Lazarus
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
델마당
볼랜드포럼 광고 모집

델파이 Q&A
Delphi Programming Q&A
[5836] [답변] BULLY/ StringGrid내용을 프린트 하는 법.
jun6812 [ ] 1307 읽음    1999-03-09 17:33
RYUSW1님께서 방법이 없다고 답변하셨지만 방법이 있습니다.
다음의 소스를 참고하시면 도움이 될 것 같군요.
간단히 스트링그리드에 이미 데이다가 있다고 가정하고
샘플로 코딩을 해봤습니다. 혹시 이해가 가지 않으시면
메일주세요....

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls, quickrpt, Grids;

type
  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    QuickRep1: TQuickRep;
    Button1: TButton;
    QRLabel1: TQRLabel;
    QRLabel2: TQRLabel;
    QRLabel3: TQRLabel;
    QRLabel4: TQRLabel;
    QRLabel5: TQRLabel;
    procedure Button1Click(Sender: TObject);
    procedure QuickRep1BeforePrint(Sender: TQuickRep;
      var PrintReport: Boolean);
    procedure QuickRep1NeedData(Sender: TObject; var MoreData: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  iPrintRow : integer;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
  QuickRep1.Print ;
end;

procedure TForm1.QuickRep1BeforePrint(Sender: TQuickRep;
  var PrintReport: Boolean);
begin
// 처음 출력할 자료의 Row Number를 지정하면 됩니다.
// 0은 스트링그리드의 처음부터 출력하는 경우임.
  iPrintRow := 0;
// 각각 조건에 따른 출력가능한 최소 RowCount를 비교함
// 최소 한개이상의 Row만 있으면 출력하는 경우임.
// 만약 FixedRow를 가지고 있는 경우라면 그에 따른 맞는 숫자를 적어줌.
  PrintReport := StringGrid1.RowCount > 1;
end;

procedure TForm1.QuickRep1NeedData(Sender: TObject; var MoreData: Boolean);
begin
  if iCurrentItem < StringGrid1.RowCount then
  begin
    QRLabel1.Caption := StringGrid1.Cells[0, iPrintRow ];
    QRLabel2.Caption := StringGrid1.Cells[1, iPrintRow ];
    QRLabel3.Caption := StringGrid1.Cells[2, iPrintRow ];
    QRLabel4.Caption := StringGrid1.Cells[3, iPrintRow ];
    QRLabel5.Caption := StringGrid1.Cells[4, iPrintRow ];
  end;
  Inc( iPrintRow );
  MoreData := iPrintRow <= StringGrid1.RowCount ;
end;

end.


+ -

관련 글 리스트
5836 [답변] BULLY/ StringGrid내용을 프린트 하는 법. jun6812 1307 1999/03/09
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.