printer.begin
Doc;
printer.Canvas.Font.Size:=11;
printer.Canvas.Font.Name:='宋体';
h:=0;
Tdytm.First;
with Tdytmdo
begin
while not(Tdytm.Eof)do
begin
with printer.Canvasdo
begin
TextOut(tdycs.FieldValues['床次1'],y,inttostr(fieldvalues['cc']));
TextOut(tdycs.FieldValues['尺码1'],y,fieldvalues['cm']);
TextOut(tdycs.FieldValues['制单1'],y,editdh.Text);
if fieldvalues['gx1']<>null then
begin
TextOut(tdycs.FieldValues['工序1'],y,inttostr(fieldvalues['gx1']));
TextOut(tdycs.FieldValues['扎号1'],y,inttostr(fieldvalues['zh']));
font.Size:=13;
TextOut(tdycs.FieldValues['件数1'],y,inttostr(fieldvalues['js']));
font.Size:=11;
TextOut(tdycs.FieldValues['工序2'],y,inttostr(fieldvalues['gx1']));
end;
case h of
0:TextOut(tdycs.FieldValues['制单2'],y,'('+editdh.Text+')');
2:TextOut(tdycs.FieldValues['制单2'],y,'('+fieldvalues['ys']+')');
4:TextOut(tdycs.FieldValues['制单2'],y,'('+inttostr(fieldvalues['js'])+'件)');
6:if fieldvalues['gh']<>null then
TextOut(tdycs.FieldValues['制单2'],y,'('+fieldvalues['gh']+')');
end;
inc(h);
TextOut(tdycs.FieldValues['床次2'],y,inttostr(fieldvalues['cc']));
TextOut(tdycs.FieldValues['尺码2'],y,fieldvalues['cm']);
TextOut(tdycs.FieldValues['制单3'],y,editdh.Text);
if fieldvalues['gx2']<>null then
begin
TextOut(tdycs.FieldValues['工序4'],y,inttostr(fieldvalues['gx2']));
TextOut(tdycs.FieldValues['扎号2'],y,inttostr(fieldvalues['zh']));
font.Size:=13;
TextOut(tdycs.FieldValues['件数2'],y,inttostr(fieldvalues['js']));
font.Size:=11;
TextOut(tdycs.FieldValues['工序3'],y,inttostr(fieldvalues['gx2']));
end;
y:=y+tdycs.FieldValues['列高']/2;
if fieldvalues['tm1']<>null then
begin
Textout(tdycs.FieldValues['床次1'],y,inttostr(fieldvalues['tm1']));
font.Name:='IntP12DlTt';
font.Size:=9;
Textout(tdycs.FieldValues['制单1'],y-5,fieldvalues['code1']);
font.Name:='宋体';
font.Size:=11;
end;
if fieldvalues['tm2']<>null then
begin
Textout(tdycs.FieldValues['床次2'],y,inttostr(fieldvalues['tm2']));
font.Name:='IntP12DlTt';
font.Size:=9;
Textout(tdycs.FieldValues['制单3'],y-5,fieldvalues['code2']);
font.Name:='宋体';
font.Size:=11;
end;
y:=y+tdycs.FieldValues['列高']/2;
TextOut(tdycs.FieldValues['床次1'],y,inttostr(fieldvalues['cc']));
TextOut(tdycs.FieldValues['尺码1'],y,fieldvalues['cm']);
TextOut(tdycs.FieldValues['制单1'],y,editdh.Text);
if fieldvalues['gx3']<>null then
begin
TextOut(tdycs.FieldValues['工序1'],y,inttostr(fieldvalues['gx3']));
TextOut(tdycs.FieldValues['扎号1'],y,inttostr(fieldvalues['zh']));
font.Size:=13;
TextOut(tdycs.FieldValues['件数1'],y,inttostr(fieldvalues['js']));
font.Size:=11;
TextOut(tdycs.FieldValues['工序2'],y,inttostr(fieldvalues['gx3']));
end;
case h of
1:TextOut(tdycs.FieldValues['制单2'],y,'('+inttostr(fieldvalues['cc'])+'床)');
3:TextOut(tdycs.FieldValues['制单2'],y,'('+inttostr(fieldvalues['zh'])+'扎)');
5:;
7:TextOut(tdycs.FieldValues['制单2'],y,'('+fieldvalues['cm']+')');
end;
inc(h);
if h>7 then
h:=0;
TextOut(tdycs.FieldValues['床次2'],y,inttostr(fieldvalues['cc']));
TextOut(tdycs.FieldValues['尺码2'],y,fieldvalues['cm']);
TextOut(tdycs.FieldValues['制单3'],y,editdh.Text);
if fieldvalues['gx4']<>null then
begin
TextOut(tdycs.FieldValues['工序4'],y,inttostr(fieldvalues['gx4']));
TextOut(tdycs.FieldValues['扎号2'],y,inttostr(fieldvalues['zh']));
font.Size:=13;
TextOut(tdycs.FieldValues['件数2'],y,inttostr(fieldvalues['js']));
font.Size:=11;
TextOut(tdycs.FieldValues['工序3'],y,inttostr(fieldvalues['gx4']));
end;
y:=y+tdycs.FieldValues['列高']/2;
if fieldvalues['tm3']<>null then
begin
Textout(tdycs.FieldValues['床次1'],y,inttostr(fieldvalues['tm3']));
font.Name:='IntP12DlTt';
font.Size:=9;
Textout(tdycs.FieldValues['制单1'],y,fieldvalues['code3']);
font.Name:='宋体';
font.Size:=11;
end;
if fieldvalues['tm4']<>null then
begin
Textout(tdycs.FieldValues['床次2'],y,inttostr(fieldvalues['tm4']));
font.Name:='IntP12DlTt';
font.Size:=9;
Textout(tdycs.FieldValues['制单3'],y,fieldvalues['code4']);
font.Name:='宋体';
font.Size:=11;
end;
y:=y+tdycs.FieldValues['列高']/2;
inc(fenye);
if fenye>10 then
begin
fenye:=0;
printer.NewPage;
y:=0 end;
end;
Tdytm.next;
end;
end;
printer.EndDoc;
这个例子,它是如何完成这个打印的呢?