C#调用BarTender 模板

时间:2024-04-03 16:03:18

 

C#调用BarTender 模板

 

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013002790/article/details/75207975

1.电脑装 BarTender软件

2.新建WINFORM测试项目

3.添加COM 组件(由安装软件目录SDK文件夹)

4.     //添加COM 引用BarTender

        实例化 

        BarTender.Application btapp;
        BarTender.Format btformat;

5.打印方法

C#调用BarTender 模板

        private void button1_Click(object sender, EventArgs e)
        {
            btapp = new BarTender.Application();
            btformat = btapp.Formats.Open(@"C:\Users\Administrator\Desktop\lable1.btw", false, "");
            btformat.PrintSetup.NumberSerializedLabels = 2; //设置打印份数
            btformat.SetNamedSubStringValue("txtGoodCode1", "品号");//

            btformat.SetNamedSubStringValue("txtGoodName1", "品名");//设置“数据源名称”
            btformat.SetNamedSubStringValue("txtOrderPo1", "订单");//
            btformat.SetNamedSubStringValue("txtCustomerGoodCode1", "客户品号");//
            btformat.SetNamedSubStringValue("txtCustomerGoodName1", "品名");//
            btformat.SetNamedSubStringValue("txtLotNo1", "批次品号");//
            btformat.SetNamedSubStringValue("txtQty1", "批次品号");//

          
            btformat.PrintOut(true, false); //第二个参数设置是否跳出打印属性;

          //btFormat.Close(BarTender.BtSaveOptions.btDoNotSaveChanges); //退出时是否保存标签   

 

 

       btApp.Quit(BarTender.BtSaveOptions.btSaveChanges);//退出时同步退出bartender进程

 

           

  }