




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、C# 调 用 b a r t e n d e r打印标签配置和测试说明C#调用bartender打印标签第一部分:配置说明useLegacyV2Run timeActivati on Policy = true;在 app.c onfig 中添加一个配置节:startupApp.config XForm、.C5Form 1 cs itrversian L 0?t -Cstartup ulseLegacyV2RuntijneAc-tIvatiomPollcy*七rue、supporteiRunf.iie: version= 百4-CT sku = u. nETFxameurork, VeE-so
2、ii=v4T 0/z- / 增加引用,BarTender 10.1 和 Seagull.Bartender.Print两个引用.dll 文件4 解夬方臬 Window?FormsAppIication 11 个項目 a 爭 windows Forms Application!Seagull.BarTender.Print_j PropertiesAfisemblyinfob _| Resources.reskJ 一引用口 Sy5tem_i System.CoreO SysterrinDataI System.Data.DataSctExtensJonz n S yste m hDt ploy
3、men tSystem. Drawing口 System,Windows,Forms vJ System.Xml口 System.Xml.LinqForml.csPrcgramcs/ 一个两个方法(用数据库和具名数据源作为区分)II方法1配置如下/标签testl.btw设置为具名数据源(数据源类型为镶入的数据)同时配对每一个输岀标签格.DSiIarTend*r Errterpriw AiirlQfMtm - ”电蔚 btw)3JW5 mki gw nmci 律科鼻 saiti 3助 flCfaw bwi-叮-A 3aSlwl.-atel |hH4-lsS ihMrI 1 5hMCflSeChW
4、IESthe EM* Ehttri* 輕5 Shecc! IE! 业曲血 HelpC哥de也*巧厅tP#m Qi窃tI和拠$IMk 曲 J=TcekiCtt wea : Q| WngSire 曲伽空 5tPk*lnQ Wfii -. 3K*-;llarte1b刑心Its/方法2:配置如下/标签test.btw设置为数据库(以excel为数据库)同时配对每一个输岀标签格第二部分:界面和代码using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.
5、Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using Seagull.BarTender.Print;using System;using System.Diagnostics;using System.Drawing.Printing;n amespaceWi ndowsFormsApplicatio n1public partial class Form1 : Formpublic Form1()In itializeComp onen t();useLegacyV2Ru ntimeActi
6、vati on Policy = true;在 app.c onfig 中添加一个配置节:startup/ 增加引用,BarTender 10.1 ,Seagull.Bartender.Print两个引用private void button1_Click( object sender, EventArgs e) / 输入内容后选择打印机BarTender.Application btApp = new BarTender. Application ();BarTender.Format btFormat;btFormat=btApp.Formats.Open( d:test1.btw , f
7、alse , ); btFormat.PrintSetup.IdenticalCopiesOfLabel=1;btFormat.PrintSetup.NumberSerializedLabels=1;btFormat.SetNamedSubStringValue( btFormat.SetNamedSubStringValue( btFormat.SetNamedSubStringValue( this .ProductCategoryNametext.Text);btFormat.SetNamedSubStringValue(this .MetalPurityNametext.Text);b
8、tFormat.SetNamedSubStringValue(this .MaterialTypeNametext.Text);btFormat.SetNamedSubStringValue( btFormat.SetNamedSubStringValue( btFormat.SetNamedSubStringValue( btFormat.SetNamedSubStringValue( btFormat.PrintOut( false , true );StyleNo , this .StyleNotext.Text);HelpCode , this .HelpCodetext.Text);
9、 ProductCategoryName ,MetalPurityName ,MaterialTypeName ,RingSize , this .RingSizetext.Text);Weight , this .Weighttext.Text);StoneQuantity , this .StoneQuantitytext.Text);StoneWeight , this .StoneWeighttext.Text);private void button3_Click( object sender, System. EventArgs e) / 导出 execl 后调用模 板选择打印机B
10、arTender.Application btApp = new BarTender. Application ();BarTender.Format btFormat;btFormat = btApp.Formats.Open( d:test.btw , false , );/btFormat.PrintSetup.IdenticalCopiesOfLabel = 1; /btFormat.PrintSetup.NumberSerializedLabels = 1; /btFormat.SetNamedSubStringValue(StyleNo, RG170403001); /btForm
11、at.SetNamedSubStringValue(HelpCode, 101765); /btFormat.SetNamedSubStringValue(ProductCategoryName, 戒指 );/btFormat.SetNamedSubStringValue(MetalPurityName, S925); /btFormat.SetNamedSubStringValue(MaterialTypeName, 锆石 );/btFormat.SetNamedSubStringValue(RingSize, 14ch); /btFormat.SetNamedSubStringValue(
12、Weight, 1.56); /btFormat.SetNamedSubStringValue(StoneQuantity, 33); /btFormat.SetNamedSubStringValue(StoneWeight, 0.123);btFormat.PrintOut( false , true );private void button4_Click( object sender, System. EventArgs e) / 输入内容后指定打印 Engine btEngine = new Engine ();btEngine.Start();LabelFormatDocument
13、btFormat = btEngine.Documents.Open( d:test1.btw ); / 指定打印机名btFormat.PrintSetup.PrinterName =Argox CP-3140L PPLB ;/ 改变标签打印数份连载 btFormat.PrintSetup.NumberOfSerializedLabels = 1;/ 打印份数btFormat.PrintSetup.IdenticalCopiesOfLabel = 1;btFormat.SubStrings btFormat.SubStrings btFormat.SubStringsStyleNo .Valu
14、e = this .StyleNotext.Text; HelpCode .Value = this .HelpCodetext.Text; ProductCategoryName .Value =this .ProductCategoryNametext.Text;btFormat.SubStrings btFormat.SubStrings btFormat.SubStrings btFormat.SubStrings btFormat.SubStringsMetalPurityName .Value = this .MetalPurityNametext.Text; MaterialTy
15、peName .Value = this .MaterialTypeNametext.Text; RingSize .Value = this .Weighttext.Text;Weight .Value = this .StoneQuantitytext.Text;StoneWeight .Value = this .StoneWeighttext.Text;Messagesmessages; int waitout = 10000;/ 10 秒 超时Result nResult1 = btFormat.Print(标签打印软件 , waitout, out messages);btForm
16、at.PrintSetup.Cache.FlushInterval = CacheFlushInterval .PerSession;/ 不保存对打开模板的修改/btFormat.Close(SaveOptions.DoNotSaveChanges);/ 结束打印引擎btEngine.Stop();private void button5_Click( object sender, System. EventArgs e) / 导出 execl 后调用模 板指定打印机BarTender.Application btApp = new BarTender. Application ();BarT
17、ender.Format btFormat;btFormat = btApp.Formats.Open( d:test.btw , false , );/btFormat.PrintSetup.IdenticalCopiesOfLabel = 1;/btFormat.PrintSetup.NumberSerializedLabels = 1;/btFormat.SetNamedSubStringValue(StyleNo, RG170403001);/btFormat.SetNamedSubStringValue(HelpCode, 101765);/btFormat.SetNamedSubS
18、tringValue(ProductCategoryName, 戒指 );/btFormat.SetNamedSubStringValue(MetalPurityName, S925); /btFormat.SetNamedSubStringValue(MaterialTypeName, 锆石 );/btFormat.SetNamedSubStringValue(RingSize, 14ch);/btFormat.SetNamedSubStringValue(Weight, 1.56);/btFormat.SetNamedSubStringValue(StoneQuantity, 33);/b
19、tFormat.SetNamedSubStringValue(StoneWeight, 0.123);btFormat.PrintOut( false , false );private void button2_Click( object sender, System. EventArgs e)/ 同一模板选择打印机/ 特别说明这里要测试的是同一个模板,先设置数据库再设置具名数据源的情况下报错/ 报错代码为 btFormat.SetNamedSubStringValue(StyleNo, this.StyleNotext.Text); 找不到具名数据源/ 测试之后发现,不能同时支持数据库和具
20、名数据源两个配置this .StyleNotext.Text = 654321 ;this .HelpCodetext.Text = 123456 ;this .ProductCategoryNametext.Text = 戒指;this .MetalPurityNametext.Text = 18 红黄白 ;this .MaterialTypeNametext.Text =爆炸石 ;this .RingSizetext.Text = 12VI ;this .Weighttext.Text =1.45 ;this .StoneQuantitytext.Text = 22 ;this .StoneWeighttext.Text = 0.034 ;BarTender.Application btApp = new BarTender. Application ();BarTender.Format btFormat;btFormat = btApp.Formats.Open( d:test1.btw , false , ); btFormat.PrintSetup.IdenticalCopiesOfLabel = 1;btFormat.PrintSetup.NumberSerializedLabels = 1;btFormat.Set
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 两栖类养殖工职业考核试卷及答案
- 变压器试验工理念考核试卷及答案
- 索具防腐蚀处理工艺考核试卷及答案
- 稻谷油脂酶解蛋白提取工艺开发考核试卷及答案
- 信息技术应用试题及答案大全
- 医学影像设备测试卷附答案
- 技术推广公司合伙协议书
- 针织专业试题及答案
- 药学相关专业试题及答案
- 河北省唐县第一中学2025-2026学年高二上学期开学考试历史试题(原卷版)
- 《北京市道路桥梁试验检测费用定额》
- 2024年下半年湖北黄冈黄梅县事业单位招聘“三支一扶”服务期满人员17人易考易错模拟试题(共500题)试卷后附参考答案
- 《小儿神经系统查体》课件
- 《初级会计实务》(第五版) 第三章 流动资产
- ps课件教学课件
- 人教版六年级上册道德与法治第一单元测试卷及答案
- 农业行政执法工作指南
- 法律行业 律师事务所品牌建设方案
- 高职计算机专业人工智能技术应用与开发
- 地铁接触网检修工技能竞赛考试题库500题(含答案)
- 2.1 创新改变生活(课件) 2024-2025学年九年级道德与法治上册 (统编版2024)
评论
0/150
提交评论