数据库表大约有5000行,我想用下面代码打印出所有的行,当打印3行后,就跳到1000行打印,当打印到1003行之后就停止打印了,请问为什么?怎么解决?procedure TForm1.Button11Click(Sender: TObject);
var
ifcontinue:bool;
x,y:longint;
hy:integer;
begin
try
x:=20;
y:=200;
printer.BeginDoc;
with printer.Canvas do
begin
adoquery2.First;
hy:=1;
while (not adoquery2.Eof) do
begin
//y:=printer.Canvas.PenPos.Y;
font.Name:='黑体';
Font.Style:=[fsBold];
font.Size:=13; //16
//textout(x+250,y+50,inttostr(jsq)+'--****费清单');
textout(x+250,y+50,inttostr(adoquery2.RecNo)+'--通话费清单'); font.Name:='宋体';
Font.Style:=[];
font.size:=12;
textout(x,y+100,'┌─────┬─────┬─────────┬─────┬─────┬─────┐');
textout(x,y+130,'│ 年度 │ 月份 │ 合同号 │ 用户名称 │ 费用1 │费用2 │');
textout(x,y+160,'├─────┼─────┼─────────┼─────┼─────┼─────┤');
textout(x, y+190,'│'+adoquery2.FieldByName('nd').AsString);
textout(x+180, y+190,'│'+adoquery2.FieldByName('yf').AsString);
textout(x+360, y+190,'│'+adoquery2.FieldByName('hth').AsString);
textout(x+660, y+190,'│'+adoquery2.FieldByName('name').AsString);
textout(x+840, y+190,'│'+adoquery2.FieldByName('fee1').AsString);
textout(x+1020,y+190,'│'+adoquery2.FieldByName('fee2').AsString);
textout(x+1200,y+190,'│');
textout(x, y+220,'└─────┴─────┴─────────┴─────┴─────┴─────┘');
textout(x, y+250,'打印日期:'+formatdatetime('yyyy-mm-dd hh:mm:ss',now));
textout(x,y+350, '**********************************************************************************');
adoquery2.Next;
if adoquery2.Eof then
break;
y:=y+430;
hy:=hy+1;
if hy=5000 then //定义每页打印的记录数,我的要求是5000行记录全部打印完才让打印机换页,
begin
hy:=1; //必须要有这4行
printer.NewPage;
X := 20;
y := 200;
end;
end;
end;
printer.enddoc;
except
showmessage('打印机错误');
end;
end;
var
ifcontinue:bool;
x,y:longint;
hy:integer;
begin
try
x:=20;
y:=200;
printer.BeginDoc;
with printer.Canvas do
begin
adoquery2.First;
hy:=1;
while (not adoquery2.Eof) do
begin
//y:=printer.Canvas.PenPos.Y;
font.Name:='黑体';
Font.Style:=[fsBold];
font.Size:=13; //16
//textout(x+250,y+50,inttostr(jsq)+'--****费清单');
textout(x+250,y+50,inttostr(adoquery2.RecNo)+'--通话费清单'); font.Name:='宋体';
Font.Style:=[];
font.size:=12;
textout(x,y+100,'┌─────┬─────┬─────────┬─────┬─────┬─────┐');
textout(x,y+130,'│ 年度 │ 月份 │ 合同号 │ 用户名称 │ 费用1 │费用2 │');
textout(x,y+160,'├─────┼─────┼─────────┼─────┼─────┼─────┤');
textout(x, y+190,'│'+adoquery2.FieldByName('nd').AsString);
textout(x+180, y+190,'│'+adoquery2.FieldByName('yf').AsString);
textout(x+360, y+190,'│'+adoquery2.FieldByName('hth').AsString);
textout(x+660, y+190,'│'+adoquery2.FieldByName('name').AsString);
textout(x+840, y+190,'│'+adoquery2.FieldByName('fee1').AsString);
textout(x+1020,y+190,'│'+adoquery2.FieldByName('fee2').AsString);
textout(x+1200,y+190,'│');
textout(x, y+220,'└─────┴─────┴─────────┴─────┴─────┴─────┘');
textout(x, y+250,'打印日期:'+formatdatetime('yyyy-mm-dd hh:mm:ss',now));
textout(x,y+350, '**********************************************************************************');
adoquery2.Next;
if adoquery2.Eof then
break;
y:=y+430;
hy:=hy+1;
if hy=5000 then //定义每页打印的记录数,我的要求是5000行记录全部打印完才让打印机换页,
begin
hy:=1; //必须要有这4行
printer.NewPage;
X := 20;
y := 200;
end;
end;
end;
printer.enddoc;
except
showmessage('打印机错误');
end;
end;
解决方案 »
- Invalid compiler directive: 'VARPROPSETTER'的错误信息
- 插入U盘怎样获取U盘盘符?
- 一个OleVariant 能做哪些操作??(比如word.application),哪里有资料??
- 通过winstock协议从大数据里取出的包 一般是什么样的格式?
- Tdatetimepicker控件的焦点控制(年、月、日)问题
- !!!!!!!赶在五一的之前升级了,祝朋友们五一快乐 8!!!!!!!!
- 关于控件组的问题,高手请进来看看
- 一个初学者关于winAPI学习的问题
- Dephi中什么数据库控件操作数据库最快呢?
- 怎样将query的查询结果返回给表?
- C++代码转换成Delphi
- 如何将一个数据集的数据移到另一个数据集中
我的要求是,打印完数据库表所有记录后才换页,
请问怎么解决???
if hy=5000 then //定义每页打印的记录数,我的要求是5000行记录全部打印完才让打印机换页,