📄 pub_rep.pas
字号:
else if nup=1 then
i_tmp:=ntop+ntmp*2
else if nup=0 then
i_tmp:=ntop+ntmp*3;
end;
if nr=9 then
begin
if nup>=4 then
i_tmp:=ntop
else if nup=3 then
i_tmp:=ntop+ntmp
else if nup=2 then
i_tmp:=ntop+ntmp*2
else if nup=1 then
i_tmp:=ntop+ntmp*3
else if nup=0 then
i_tmp:=ntop+ntmp*4;
end;
end;
end;
result:=i_tmp;
end;
{取得表头行的宽度}
function getwidth(mygrid:TStringGrid;nc,nr:integer;b_xh:boolean):integer;
var
i:integer;
nl,nright:integer; //截取字符串后所的长度
nwidth,nlwidth,nrwidth:integer; //宽度
ntemp:integer;
begin
nlwidth:=0;
nrwidth:=0;
nwidth:=0;
ntemp:=0;
if mygrid.Cells[nc,nr]<>'' then
begin
nl:=getwidthl(mygrid.Cells[nc,nr]);
nright:=getwidthr(mygrid.Cells[nc,nr]);
if nl>=nc then
begin
for i:=0 to nc-1 do
ntemp:=ntemp+mygrid.ColWidths[i];
if b_xh then
nlwidth:=ntemp
else
nlwidth:=ntemp-mygrid.ColWidths[0];
end
else if (nl>0) and (nl<nc) then
begin
for i:=nc-1 downto nl do
nlwidth:=nlwidth+mygrid.ColWidths[i];
end
else if nl=0 then
nlwidth:=0;
if nright>=mygrid.ColCount-nc+1 then
begin
nright:=mygrid.ColCount-nc+1;
for i:=0 to nright-1 do
nrwidth:=nrwidth+mygrid.ColWidths[i+nc+1];
end
else if (nright>0) and (nright<mygrid.ColCount-nc+1) then
begin
for i:=0 to nright-1 do
nrwidth:=nrwidth+mygrid.ColWidths[i+nc+1];
end
else if nright=0 then
nrwidth:=0;
nwidth:=nlwidth+nrwidth+mygrid.ColWidths[nc];
end;
Result:=nwidth;
end;
{计算报表总长度}
function getl(mygrid:TStringGrid;nc:integer;nw:integer):integer;
var
temp:integer;
i:integer;
i_tmp:integer;
begin
temp:=0;
// nw:=nw*3;
for i:=0 to nc-1 do
begin
temp:=temp+mygrid.ColWidths[i];
end;
if Trim(array_jbxx[1])='1' then
i_tmp:=temp+nw
else
i_tmp:=temp+nw-mygrid.ColWidths[0];
result:=i_tmp;
end;
{计算表注部分的高度}
function getup(str11,str12,str13,str21,str22,str23,str31,str32,str33:string):integer;
var
ntmp:integer;
begin
ntmp:=0;
if ((Trim(str11)<>'') or (Trim(str21)<>'') or (Trim(str31)<>''))
and ((Trim(str12)<>'') or (Trim(str22)<>'') or (Trim(str32)<>''))
and ((Trim(str13)<>'') or (Trim(str23)<>'') or (Trim(str33)<>'')) then
ntmp:=60
else
if ((Trim(str11)<>'') or (Trim(str21)<>'') or (Trim(str31)<>''))
and ((Trim(str12)<>'') or (Trim(str22)<>'') or (Trim(str32)<>''))
and (Trim(str13)='') and (Trim(str23)='') and (Trim(str33)='') then
ntmp:=40
else
if ((Trim(str11)<>'') or (Trim(str21)<>'') or (Trim(str31)<>''))
and (Trim(str12)='') and (Trim(str22)='') and (Trim(str32)='')
and (Trim(str13)='') and (Trim(str23)='') and (Trim(str33)='') then
ntmp:=20
else
if ((Trim(str11)<>'') or (Trim(str21)<>'') or (Trim(str31)<>'')
or (Trim(str12)<>'') or (Trim(str22)<>'') or (Trim(str32)<>''))
and (Trim(str13)='') and (Trim(str23)='') and (Trim(str33)='') then
ntmp:=40
else
if (Trim(str11)='') and (Trim(str21)='') and (Trim(str31)='')
and (Trim(str12)='') and (Trim(str22)='') and (Trim(str32)='')
and (Trim(str13)='') and (Trim(str23)='') and (Trim(str33)='') then
ntmp:=0;
Result:=ntmp;
end;
{表头总高度}
function gethead(mygrid:TStringGrid;ntmp:integer):integer; //表头总高度
var
nrowcount:integer;
nh:integer;
begin
nh:=0;
nrowcount:=mygrid.RowCount;
if nrowcount=6 then
nh:=ntmp
else if nrowcount=7 then
nh:=ntmp*2
else if nrowcount=8 then
nh:=ntmp*3
else if nrowcount=9 then
nh:=ntmp*4
else if nrowcount=10 then
nh:=ntmp*5;
Result:=nh;
end;
{纸的宽度}
function getpagew(nw:integer;b_xh:boolean):integer;
begin
if b_xh then
nw:=756
else
nw:=1069;
Result:=nw;
end;
{报表的高度}
function getpageh(nh:integer;b_xh:boolean):integer;
begin
if b_xh then
nh:=1069
else
nh:=769;
Result:=nh;
end;
{取得报表标题的frametyp}
function getframetyp(str:string):integer;
var
npos:integer;
nlen:integer;
nt:integer;
nb:integer;
nr:integer;
nl:integer;
ntemp:integer;
ntmp:integer;
strtemp:string;
strtmp:string;
begin
ntmp:=15;
nlen:=Length(Trim(str));
if nlen>0 then
begin
npos:=pos('^',str);
if npos<>0 then
begin
strtmp:=copy(str,npos+1,nlen);
ntemp:=pos('s',strtmp);
if ntemp<>0 then
begin
strtemp:=copy(strtmp,ntemp+1,1);
try
nt:=strtoint(strtemp);
except
nt:=1;
end;
end
else
nt:=1;
ntemp:=pos('x',strtmp);
if ntemp<>0 then
begin
strtemp:=copy(strtmp,ntemp+1,1);
try
nb:=strtoint(strtemp);
except
nb:=1;
end;
end
else
nb:=1;
ntemp:=pos('z',strtmp);
if ntemp<>0 then
begin
strtemp:=copy(strtmp,ntemp+1,1);
try
nl:=strtoint(strtemp);
except
nl:=1;
end;
end
else
nl:=1;
ntemp:=pos('y',strtmp);
if ntemp<>0 then
begin
strtemp:=copy(strtmp,ntemp+1,1);
try
nr:=strtoint(strtemp);
except
nr:=1;
end;
end
else
nr:=1;
if (nr=0) and (nl=0) and (nb=0) and (nt=0) then ntmp:=0;
if (nr<>0) and (nl=0) and (nb=0) and (nt=0) then ntmp:=1;
if (nr=0) and (nl=0) and (nb<>0) and (nt=0) then ntmp:=2;
if (nr<>0) and (nl=0) and (nb<>0) and (nt=0) then ntmp:=3;
if (nr=0) and (nl<>0) and (nb=0) and (nt=0) then ntmp:=4;
if (nr<>0) and (nl<>0) and (nb=0) and (nt=0) then ntmp:=5;
if (nr=0) and (nl<>0) and (nb<>0) and (nt=0) then ntmp:=6;
if (nr<>0) and (nl<>0) and (nb<>0) and (nt=0) then ntmp:=7;
if (nr=0) and (nl=0) and (nb=0) and (nt<>0) then ntmp:=8;
if (nr<>0) and (nl=0) and (nb=0) and (nt<>0) then ntmp:=9;
if (nr=0) and (nl=0) and (nb<>0) and (nt<>0) then ntmp:=10;
if (nr<>0) and (nl=0) and (nb<>0) and (nt<>0) then ntmp:=11;
if (nr=0) and (nl<>0) and (nb=0) and (nt<>0) then ntmp:=12;
if (nr<>0) and (nl<>0) and (nb=0) and (nt<>0) then ntmp:=13;
if (nr=0) and (nl<>0) and (nb<>0) and (nt<>0) then ntmp:=14;
if (nr<>0) and (nl<>0) and (nb<>0) and (nt<>0) then ntmp:=15;
end
else
ntmp:=15;
end
else
ntmp:=0;
Result:=ntmp;
end;
{取的表注部分字符串}
function getstr(str:string):string;
var
strtmp:string;
strtemp:string;
rq:string; //日期
dqsj:string; //当前时间
dqyh:string; //当前页号
zys:string; //总页数
gcmc:string; //工程名称
nleg:integer;
i,j:integer;
begin
//rq:='[DATE]';
rq:=FormatDateTime('dddddd',Now);
dqsj:='[TIME]';
dqyh:=inttostr(npagetmp);;
zys:=inttostr(npagecount);
gcmc:=Trim((getactiveform as TFrm_ys).gc_info.Cells[3,2]);
setvalues((getactiveform as TFrm_ys).gc_info);
nleg:=length(str);
if nleg>0 then
begin
while pos('rq',str)<>0 do
begin
i:=pos('rq',str);
strtmp:=copy(str,1,i-1);
strtemp:=copy(str,i+2,nleg-i+3);
str:=strtmp+rq+strtemp;
end;
while pos('dqsj',str)<>0 do
begin
i:=pos('dqsj',str);
strtmp:=copy(str,1,i-1);
strtemp:=copy(str,i+4,nleg-i+5);
str:=strtmp+dqsj+strtemp;
end;
while pos('dqyh',str)<>0 do
begin
i:=pos('dqyh',str);
strtmp:=copy(str,1,i-1);
strtemp:=copy(str,i+4,nleg-i+5);
str:=strtmp+dqyh+strtemp;
end;
while pos('zys',str)<>0 do
begin
i:=pos('zys',str);
strtmp:=copy(str,1,i-1);
strtemp:=copy(str,i+3,nleg-i+4);
str:=strtmp+zys+strtemp;
end;
while pos('gcmc',str)<>0 do
begin
i:=pos('gcmc',str);
strtmp:=copy(str,1,i-1);
strtemp:=copy(str,i+4,nleg-i+5);
str:=strtmp+gcmc+strtemp;
end;
// array_gcxx[i]:=Trim(mygrid.Cells[2,nr]);
// array_gcsj[i]:=Trim(mygrid.Cells[3,nr]);
for j:=1 to 100 do {处理工程信息}
begin
if Trim(array_gcxx[j])<>'' then
begin
while pos(array_gcxx[j],str)<>0 do
begin
i:=pos(array_gcxx[j],str);
strtmp:=copy(str,1,i-1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -