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.
|