procedure TFormOrgBudgetReport.DetailBand1BeforePrint( Sender: TQRCustomBand; var PrintBand: Boolean); var lHeight: integer; lStr: string; begin lHeight := 0; lStr := TrimRight(str2wstr(QuickRepOrgBudget.DataSet.FieldByName('EmployeeNameAs').AsString)); if QuickRepOrgBudget.TextWidth(QRExprNameAs.Font, lStr) mod QRExprNameAs.Width > 0 then begin if QuickRepOrgBudget.TextWidth(QRExprNameAs.Font, lStr) < QRExprNameAs.Width then lHeight := 1 else lHeight := QuickRepOrgBudget.TextWidth(QRExprNameAs.Font, lStr) div QRExprNameAs.Width + 1; end;
Sender: TQRCustomBand; var PrintBand: Boolean);
var
lHeight: integer;
lStr: string;
begin
lHeight := 0;
lStr := TrimRight(str2wstr(QuickRepOrgBudget.DataSet.FieldByName('EmployeeNameAs').AsString));
if QuickRepOrgBudget.TextWidth(QRExprNameAs.Font, lStr) mod QRExprNameAs.Width > 0 then
begin
if QuickRepOrgBudget.TextWidth(QRExprNameAs.Font, lStr) < QRExprNameAs.Width then
lHeight := 1
else
lHeight := QuickRepOrgBudget.TextWidth(QRExprNameAs.Font, lStr) div QRExprNameAs.Width + 1;
end;
Sender.Height := Sender.Height * lHeight + 5;
end;//你自己再改改就行啦。lHeight就是行数。