|
楼主 |
发表于 2020-3-10 23:20:38
|
显示全部楼层
广东省东莞市
附上C#的脚本
程序实现:
注意首先添加引用:Lppx2.tlb (codesoft安装后文件中)
using LabelManager2; //引入命名空间
private void btnPrint_Click(object sender, EventArgs e)
{
ApplicationClass lbl = new ApplicationClass();
try
{
lbl.Documents.Open(@"D:label.Lab", false);// 调用设计好的label文件
Document doc = lbl.ActiveDocument;
doc.Variables.FormVariables.Item("Var0").Value = txtContent.Text.Trim(); //给参数传值
doc.Variables.FormVariables.Item("Var1").Value = txtContent2.Text.Trim(); //给参数传值
int Num = Convert.ToInt32(txtQuentity.Text); //打印数量
doc.PrintDocument(Num); //打印
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
lbl.Quit(); //退出
}
} |
|