随笔 - 6  文章 - 129  trackbacks - 0
<2024年4月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

常用链接

留言簿(14)

随笔档案(6)

文章分类(467)

文章档案(423)

相册

收藏夹(18)

JAVA

搜索

  •  

积分与排名

  • 积分 - 814904
  • 排名 - 49

最新评论

阅读排行榜

评论排行榜

轉:http://download.csdn.net/source/876883

Delphi+Codesoft 7.0 调用条码格式文件打印


procedure TFormMain.btnPrintClick(Sender: TObject);
Var
s: string;
i : Integer;
BarApp,BarDoc,BarVars:Variant; // OLE 变量
Begin
if not FileExists(edtBClabelName.Text) then
begin
stat.Panels[2].Text := 'The Barcode Document is not Exists.';
ShowMessage('The Barcode Document is not Exists.');
Exit;
btnOpen.SetFocus;
end;

BarApp := CreateOleObject('lppx.Application');
//arApp.Visible:=True;
BarApp.Visible:=False;

BarDoc:=BarApp.ActiveDocument;
BarVars:=BarDoc.Variables;
BarDoc.Open(edtBClabelName.Text);

// 变量赋值
if chkParam.Checked then
begin
BarDoc.Variables.Item('var1').Value:= edtPN.Text;
BarDoc.Variables.Item('var2').Value:= edtPartName.Text;
BarDoc.Variables.Item('var3').Value:= edtDesc.Text;
end;

// 打印标签
Bardoc.Printlabel(seqty.Value);
// Feed
BarDoc.FormFeed;
// 关闭
Bardoc.Close;
BarApp.Quit;
End;

如果报Undeclare identified 'CreateOleObject' 错误, 则引入ComObj 即可


posted on 2010-05-14 08:12 Ke 阅读(1277) 评论(0)  编辑  收藏 所属分类: delphi

只有注册用户登录后才能发表评论。


网站导航: