通过DELPHI实现对标签的批量打印

来源:互联网 发布:葛巾的知乎回答集锦 编辑:程序博客网 时间:2024/06/14 17:19

Var c : textfile;
    a: integer;


begin
   ASSIGNFILE(C,'PBarcode.txt');
   for a:=1 to Strtoint(zs.text)  do
     begin
     rewrite(c);
     writeln(c,'Startprint,EPSON_A');
     Writeln(c,'FMT,100,80,FALSE');
     Writeln(c,'pit,-6');
     writeln(c,'getbim,3,46,"1,'+SLOT.Text +','+ custpn.text +'",4,1.5');
     writeln(c,'getbim,3,1,"(P)C P/N:'+ CustpN.text +'",4,1.5');
     writeln(c,'BFL,3,4,0,29,4,"'+ Custpn.text +'",2,2');
     writeln(c,'getbim,3,8,"(Q)QTY:'+ SQTY.text +'",4,1.5');
     writeln(c,'BFL,3,11,0,29,4,"Q'+ SQTY.Text +'",2,2');
     writeln(c,'getbim,3,14,"(M)Mfr P/N'+ CLSPN.text +'",4,1.5');
     writeln(c,'BFL,3,18,0,29,4,"M'+ CLSPN.Text +'",2,2');
     writeln(c,'getbim,3,22,"(D)Date Code:'+ SDATE. text +'",4,1.5');
     writeln(c,'BFL,3,25,0,29,4,"D'+ SDATE.Text +'",2,2');
     writeln(c,'getbim,3,29,"(L)Lot#:'+ SLOT.text +'",4,1.5');
     writeln(c,'BFL,3,32,0,29,4,"L'+ SLOT.Text +'",2,2');
     writeln(c,'getbim,3,36,"(S)PKG ID:'+ CUSTLOT. text +'",4,1.5');
     writeln(c,'BFL,3,39,0,29,4,"S'+ CUSTLOT.Text +'",2,2');
     writeln(c,'getBim,33,45,"RoHS",4,1.3');
     writeln(c,'BOX,32,44,42,50,1,5,0');
     writeln(c,'getBim,3,66,"xxxxx",3,1.3');
     writeln(c,'getBim,3,69,"lllllll",3,1.3');
     Writeln(c,'prt,1');
     Writeln(c,'ID,50');
     Writeln(c,'endprint');
     closefile(c);
     Winexec('PL.exe',sw_HIDE);
      end;
   end;

以上是BUTTION代码处的代码!

ASSIGNFILE procedure

Associates the name of an external file with a file variable.

Delphi syntax:

procedure AssignFile(var F; FileName: string);

 

StrToInt function

Converts a string that represents an integer (decimal or hex notation) to a number.

Delphi syntax:

function StrToInt(const S: string): Integer;

 

Rewrite procedure

Creates a new file and opens it.

Delphi syntax:

procedure Rewrite(var F: File [; Recsize: Word ] );

 

WriteLn procedure

Writes to a text file and adds an end-of-line marker.

Delphi syntax:

procedure WriteLn([ var F: Text; ] P1 [, P2, ...,Pn ] );

 

CloseFile procedure

Terminates the association between file variable and an external disk file.

Delphi syntax:

procedure CloseFile(var F);

 

 

 

原创粉丝点击