VB使用ZPL指令控制zebra打印机案例

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

VB使用ZPL指令控制zebra打印机案例DimiAsInteger,jAsInteger,nCountAsInteger,col_countAsLongDimzpl_head(12)AsString,zpl_footAsStringDimcell_width_iniAsInteger,cell_height_ini(3)AsIntegerDimtmp_MAC()AsString,tmp_SN()AsStringDimzpl_text_MAC()AsString,zpl_text_SN()AsStringDimzpl_barcode_MAC()AsString,zpl_barcode_SN()AsStringDimcbufAsString*21000'**************************'设置打印开始信息'**************************zpl_head(0)=^XA'起始符zpl_head(1)=^LH0,0'参考点zpl_head(2)=^FO540,60^GB0,1850,7^FS'竖线zpl_head(3)=^FO1025,60^GB0,1850,7^FS'竖线zpl_head(4)=^FO10,242^GB1100,0,7^FS'横线zpl_head(5)=^FO10,422^GB1100,0,7^FS'横线zpl_head(6)=^FO10,602^GB1100,0,7^FS'横线zpl_head(7)=^FO10,782^GB1100,0,7^FS'横线zpl_head(8)=^FO10,962^GB1100,0,7^FS'横线zpl_head(9)=^FO10,1152^GB1100,0,7^FS'横线zpl_head(10)=^FO10,1332^GB1100,0,7^FS'横线zpl_head(11)=^FO10,1512^GB1100,0,7^FS'横线zpl_head(12)=^FO10,1692^GB1100,0,7^FS'横线'*******************************'计算列循环次数,各数组下标'*******************************col_count=(Grid1.Rows-1)/10+CInt(CBool((Grid1.Rows-1)Mod10))*(-1)ReDimtmp_MAC(Grid1.Rows-1)ReDimtmp_SN(Grid1.Rows-1)ReDimzpl_text_MAC(Grid1.Rows-1)ReDimzpl_text_SN(Grid1.Rows-1)ReDimzpl_barcode_MAC(Grid1.Rows-1)ReDimzpl_barcode_SN(Grid1.Rows-1)'*******************************'设置标签体'*******************************'单元初始X坐标cell_width_ini=97Fori=1Tocol_count'单元初始Y坐标cell_height_ini(0)=88cell_height_ini(1)=116cell_height_ini(2)=147cell_height_ini(3)=180Forj=1To10'第一单元:MAC文字nCount=GETFONTHEX(MAC:&Grid1.TextMatrix((i-1)*10+j,0),verdana,MAC&CStr((i-1)*10+j),0,32,16,0,0,cbuf)tmp_MAC((i-1)*10+j)=Mid(cbuf,1,nCount)zpl_text_MAC((i-1)*10+j)=^FO&CStr(cell_width_ini)&,&CStr(cell_height_ini(0))&^XG&MAC&CStr((i-1)*10+j)&,1,1^FS'第二单元:MAC条码zpl_barcode_MAC((i-1)*10+j)=^FO&CStr(cell_width_ini)&,&CStr(cell_height_ini(1))&^BCN,33,N,N^FD&Grid1.TextMatrix((i-1)*10+j,0)&^BY1.87,5.369^FS'第三单元:SN文字nCount=GETFONTHEX(S/N:&Grid1.TextMatrix((i-1)*10+j,1),verdana,SN&CStr((i-1)*10+j),0,32,16,0,0,cbuf)tmp_SN((i-1)*10+j)=Mid(cbuf,1,nCount)zpl_text_SN((i-1)*10+j)=^FO&CStr(cell_width_ini)&,&CStr(cell_height_ini(2))&^XG&SN&CStr((i-1)*10+j)&,1,1^FS'第四单元:SN条码zpl_barcode_SN((i-1)*10+j)=^FO&CStr(cell_width_ini)&,&CStr(cell_height_ini(3))&^BCN,33,N,N^FD&Grid1.TextMatrix((i-1)*10+j,1)&^BY1.87,5.369^FSIf(i-1)*10+j=Grid1.Rows-1ThenExitForEndIfcell_height_ini(0)=cell_height_ini(0)+180cell_height_ini(1)=cell_height_ini(1)+180cell_height_ini(2)=cell_height_ini(2)+180cell_height_ini(3)=cell_height_ini(3)+180NextiNextjcell_width_ini=cell_width_ini+500'*******************************'设置标签结束信息'*******************************zpl_foot=^XZ'*******************************'输出信息'*******************************Dimstr1AsString,str2AsString,str3AsString,str4AsStringstr1=str2=str3=str4=Fori=0To12str1=str1&zpl_head(i)&Chr(13)NextFori=0ToGrid1.Rows-1str2=str2&tmp_MAC(i)&Chr(13)str3=str3&tmp_SN(i)&Chr(13)NextFori=0ToGrid1.Rows-1str4=str4&zpl_text_MAC(i)&Chr(13)str4=str4&zpl_barcode_MAC(i)&Chr(13)str4=str4&zpl_text_SN(i)&Chr(13)str4=str4&zpl_barcode_SN(i)&Chr(13)Next

1 / 3
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功