NewPage 后 打印的起始位置为什么发生变化? 是否与打印边距有关?如何解决?
function Tfrm_SelfPrn.ToPrn_DataRec(DataRecSour: TDataSet): integer;
var
i,j,k,m,p,pt : integer;
str_BankRollCode,
str_BankRollName,
strRoll_mMoneyRealOut : string;
curRoll_mMoneyRealOut : currency;
strSpace : string;
s1,s2,s3 : string;
c1 : Currency;
begin
Result := 0;
i := 0;
j := 580;
k := 0;
m := 0;
p := 0;
pt := 0;
str_BankRollCode := '';
str_BankRollName := '';
strRoll_mMoneyRealOut := '';
strSpace := '';
curRoll_mMoneyRealOut := 0;
//intPrnPageHigh := Printer.PageHeight ;
pt := DataRecSour.RecordCount DIV 30 ;
if DataRecSour.RecordCount MOD 30 <> 0 then
pt := pt +1;
try
with Printer.Canvas do
begin
DataRecSour.First;
Printer.BeginDoc; // 数据开始进打印缓冲
while Not DataRecSour.Eof do
begin
ToPrn_CreColSour(s1, s2,s3,DataRecSour);
str_BankRollCode := s1;
str_BankRollName := s2;
strRoll_mMoneyRealOut := s3;
p := Printer.PageNumber;
j := j + 60;
m := m + 1;
if ToPrn_Head(DataRecSour) <> 1 then
begin
Result := 0;
exit;
end;
if (ToPrn_Title(DataRecSour) <> 1)
then
begin
Result := 0;
exit;
end;
ToPrn_Col(pixMM.PixelX(k),pixMM.PixelY(j),
str_BankRollCode,
str_BankRollName,strRoll_mMoneyRealOut);
if (ToPrn_UFLogPage(DataRecSour,P,PT) <> 1)
then
begin
Result := 0;
exit;
end;
if DataRecSour.RecNo =
DataRecSour.RecordCount then
begin
if ToPrn_SumMoney(DataRecSour) <> 1 then
begin
Result := 0;
exit;
end;
end;
if (m MOD 30) = 0 then
begin
j := 580;
m := 0;
Printer.NewPage;
end;
DataRecSour.Next;
end;
Printer.EndDoc; // 数据进打印缓冲完毕,开始打印
end;
except
Messagedlg('打印循环错误!',mtError,[mbOk],0);
Result := 0;
exit;
end;
Result := 1;
end;