아래 소스입니다. 부탁드려요
인쇄할때는 frmPrint.qrDoc.Print
프리뷰할때는 frmPrint.qrDoc.PrintPreview
명령을 사용했습니다.
procedure TfrmPrint.qrDocNeedData(Sender: TObject; var MoreData: Boolean);
begin
MoreData := (frmMain.grdWork.RowCount - 1) <> RowCnt;
end;
procedure TfrmPrint.qrDocBeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
begin
RowCnt := 0;
end;
procedure TfrmPrint.QRDetailBeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
W001.Caption := frmMain.grdWork.Cells[1,RowCnt];
W002.Caption := frmMain.grdWork.Cells[2,RowCnt];
W003.Caption := frmMain.grdWork.Cells[3,RowCnt];
W004.Caption := frmMain.grdWork.Cells[4,RowCnt];
W005.Caption := frmMain.grdWork.Cells[5,RowCnt];
W006.Caption := frmMain.grdWork.Cells[6,RowCnt];
W007.Caption := frmMain.grdWork.Cells[7,RowCnt];
end;
procedure TfrmPrint.qrDocPreview(Sender: TObject);
begin
RowCnt := 0;
end;
procedure TfrmPrint.QRDetailAfterPrint(Sender: TQRCustomBand;
BandPrinted: Boolean);
begin
RowCnt := RowCnt + 1;
end;