换行函数:
function TfrmTechReport.AdjustReport(QRBand:TQRBand;txt:TQRDBText;var blnDetailFlag:Boolean;
QRShape:TQRShape;intPos:integer;var Value:string):string;
var
strValue,strTmp:string;
i,intValue,intTmp,intCount:integer;
begin
strValue:=Trim(value);
intValue:=Length(strValue);
intTmp:=1;
intCount:=0;
strTmp:='';
if intValue>intPos then
begin
while intTmp<=intValuedo
begin
if ByteType(strValue,intPos+intTmp-1)=mbLeadByte then
//双字符中间
begin
strTmp:=strTmp+Copy(strValue,intTmp,intPos-1)+#10#13;
intTmp:=intTmp+intPos-1;
intCount:=intCount+1;
end
else
begin
strTmp:=strTmp+Copy(strValue,intTmp,intPos)+#10#13;
intTmp:=intTmp+intPos;
intCount:=intCount+1;
end
end;
Result:=strTmp;
txt.top:=5;
txt.Height:=14*intCount;
if blnDetailFlag then
exit;
QRBand.Height:=14*(intCount+1);
QRShape.Top:=QRBand.Height-4;
//横线
for I:=0 to QRBand.ControlCount-1do
begin
if QRBand.Controls is TQRShape then
if TQRShape(QRBand.Controls).Shape=qrsVertLine then
begin
TQRShape(QRBand.Controls).Height:=QRBand.Height;
TQRShape(QRBand.Controls).Top:=0;
end;
end;
blnDetailFlag:=true;
end
else
begin
Result:=strValue;
txt.top:=5;
txt.Height:=14;
if blnDetailFlag then
exit;
QRBand.Height:=24;
QRShape.Top:=QRBand.Height-4;
for I:=0 to QRBand.ControlCount-1do
begin
if QRBand.Controls is TQRShape then
if TQRShape(QRBand.Controls).Shape=qrsVertLine then
begin
TQRShape(QRBand.Controls).Height:=QRBand.Height;
TQRShape(QRBand.Controls).Top:=0;
end;
end;
end;
end;