用TQRRichText在QuickRep.OnNeedData中手工写入数据
procedure TQRListForm.QuickRep1NeedData(Sender: TObject;
var MoreData: Boolean);
var mc:WideString;
n:integer;
begin
MoreData:=true;
with datamodule1.Query3 do
begin
mc:=fieldbyname('mc').AsString;
QRRichText1.Lines.Text:=mc;
if fieldbyname('bh').AsString='***' then
begin
QRLabel14.Caption:='';
QRLabel15.Caption:=mc;
QRRichText1.Lines.Clear;
QRLabel18.Caption:='';
QRLabel19.Caption:='';
QRLabel20.Caption:='';
QRLabel15.Left:=(QRShape19.Left-QRLabel15.Width)div 2;
DetailBand1.Height:=24+RowHeight;
QRShape11.Top:=22+RowHeight;
QRShape13.Enabled:=false;
QRShape14.Enabled:=false;
QRShape15.Enabled:=false;
QRShape16.Enabled:=false;
QRShape17.Enabled:=false;
QRShape18.Enabled:=false;
QRRichText1.Height:=16+RowHeight div 2;
end
else
begin
QRShape13.Enabled:=true;
QRShape14.Enabled:=true;
QRShape15.Enabled:=true;
QRShape16.Enabled:=true;
QRShape17.Enabled:=true;
QRShape18.Enabled:=true;
QRLabel15.Left:=QRShape13.Left+2;
if copy(fieldbyname('bh').AsString,1,4)='****' then
begin
QRLabel14.Caption:='';
QRLabel15.Caption:=trim(copy(fieldbyname('bh').AsString,5,16));
end
else
begin
i:=i+1;
QRLabel14.Caption:=inttostr(i);
QRLabel15.Caption:=fieldbyname('bh').AsString;
end;
QRRichText2.Lines.Text:=fieldbyname('hsgs').AsString;
if (QRRichText1.Lines.Count>1)or(QRRichText2.Lines.Count>1) then
begin
if QRRichText1.Lines.Count>QRRichText2.Lines.Count then
n:=QRRichText1.Lines.Count
else
n:=QRRichText2.Lines.Count;
DetailBand1.Height:=24+RowHeight+10*n;
QRListForm.QRShape12.Height:=24+RowHeight+10*n;
QRLIstForm.QRShape11.Top:=22+RowHeight+10*n;
QRShape13.Height:=24+RowHeight+10*n;
QRShape14.Height:=24+RowHeight+10*n;
QRShape15.Height:=24+RowHeight+10*n;
QRShape16.Height:=24+RowHeight+10*n;
QRShape17.Height:=24+RowHeight+10*n;
QRShape18.Height:=24+RowHeight+10*n;
QRShape19.Height:=24+RowHeight+10*n;
QRRichText1.Height:=26+RowHeight div 2+10*n;
QRRichText2.Height:=24+RowHeight div 2+10*n;
end
else
begin
DetailBand1.Height:=24+RowHeight;
QRListForm.QRShape12.Height:=24+RowHeight;
QRShape11.Top:=22+RowHeight;
QRShape13.Height:=24+RowHeight;
QRShape14.Height:=24+RowHeight;
QRShape15.Height:=24+RowHeight;
QRShape16.Height:=24+RowHeight;
QRShape17.Height:=24+RowHeight;
QRShape18.Height:=24+RowHeight;
QRShape19.Height:=24+RowHeight;
QRRichText1.Height:=16+RowHeight div 2;
QRRichText2.Height:=14+RowHeight div 2;
end;
nRowH:=nRowH+DetailBand1.Height;
QRLabel18.Caption:=fieldbyname('dw').AsString;
if fieldbyname('q').AsFloat=0 then
QRLabel19.Caption:=''
else
QRLabel19.Caption:=formatfloat('0.000',fieldbyname('q').AsFloat);
if fieldbyname('jj').AsFloat=0 then
QRLabel20.Caption:=''
else
QRLabel20.Caption:=formatfloat('0.00',fieldbyname('jj').AsFloat);
end;
if(PrintHeight-nRowH>0)and(PrintHeight-nRowH<=Detailband1.Height)then
QRShape11.Height:=2
else
QRShape11.Height:=1;
if eof then
begin
if form38.IsSpace then
begin
QRLabel14.Caption:='';
QRLabel15.Caption:='';
QRRichText1.Lines.Clear;
QRRichText2.Lines.Clear;
QRLabel18.Caption:='';
QRLabel19.Caption:='';
QRLabel20.Caption:='';
if nRowH>=PrintHeight then
MoreData:=false;
end
else
MoreData:=false;
end;
next;
end;
end;