可以,但比较麻烦,将QrLabel放在DetailBand里,在QuickReport的OnNeedData里写事件,
控件MoreData=True时打印,=False不打印,注意不能设QuickReport的DataSet属性
var
// My_Variant: array[0..10, 0..20] of string;
l_High : Integer;
l_CurrentRow: Integer;
{$R *.DFM}
procedure TForm1.QuickRep1BeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
begin
l_High := High(My_Variant);
l_CurrentRow := 0;
end;
procedure TForm1.QuickRep1NeedData(Sender: TObject;
var MoreData: Boolean);
begin
MoreData:=False;
if l_CurrentRow = l_High + 1 then
{如果已打印完最后行,退出}
Exit;
MoreData := True;
{可以继续打印}
QRLabel1.Caption := My_Variant[l_CurrentRow, 0];
{打印第一列}
QRLabel2.Caption := My_Variant[l_CurrentRow, 1];
{打印第二列}
QRLabel3.Caption := My_Variant[l_CurrentRow, 2];
{打印第三列}
l_CurrentRow := l_CurrentRow + 1;
{当前行+1}
end;