W
weifang
Unregistered / Unconfirmed
GUEST, unregistred user!
用delphi6.0自帶的QuickRep做報表。以下是讓QRDBText1自動換行過程。但是QRShape高度不會隨著DetailBand1的高度變化而變化。1: 怎樣解決QRShape高度問題呢? 2: 有沒有更好的換行代碼(下面的換行過程有點問題,有時會切去字符)?請個位高手相助!
procedure Tfm_form.QRDBText1Print(sender: TObject;
var Value: String);
var
iLen : integer;
strSource, strTemp : string;
begin
if Length(Value) <= QRDBText12.Width/7 then
exit;
strSource := Value;
Value := '';
while truedo
begin
iLen := 1;
while iLen < QRDBText12.Width/7do
begin
if ord(strSource[iLen]) > 334 then
inc(iLen, 2)
else
inc(iLen);
end;
dec(iLen);
strTemp := Copy(strSource, 1, iLen);
if Value = '' then
Value := strTemp
else
Value := Value + #13 + strTemp;
strSource := Copy(strSource, iLen + 1, Length(strSource) - iLen);
if Length(strSource) <= QRDBText12.Width/7 then
begin
Value := Value + #13 + strSource;
exit;
end;
end;
end;
procedure Tfm_form.QRDBText1Print(sender: TObject;
var Value: String);
var
iLen : integer;
strSource, strTemp : string;
begin
if Length(Value) <= QRDBText12.Width/7 then
exit;
strSource := Value;
Value := '';
while truedo
begin
iLen := 1;
while iLen < QRDBText12.Width/7do
begin
if ord(strSource[iLen]) > 334 then
inc(iLen, 2)
else
inc(iLen);
end;
dec(iLen);
strTemp := Copy(strSource, 1, iLen);
if Value = '' then
Value := strTemp
else
Value := Value + #13 + strTemp;
strSource := Copy(strSource, iLen + 1, Length(strSource) - iLen);
if Length(strSource) <= QRDBText12.Width/7 then
begin
Value := Value + #13 + strSource;
exit;
end;
end;
end;