




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、精選優(yōu)質(zhì)文檔-傾情為你奉上精選優(yōu)質(zhì)文檔-傾情為你奉上專心-專注-專業(yè)專心-專注-專業(yè)精選優(yōu)質(zhì)文檔-傾情為你奉上專心-專注-專業(yè)C#調(diào)用bartender打印標(biāo)簽第一部分:配置說明/useLegacyV2RuntimeActivationPolicy = true;在app.config中添加一個配置節(jié):startup/增加引用,BarTender 10.1 和Seagull.Bartender.Print 兩個引用.dll文件/一個兩個方法(用數(shù)據(jù)庫和具名數(shù)據(jù)源作為區(qū)分)/方法1:配置如下/標(biāo)簽test1.btw 設(shè)置為具名數(shù)據(jù)源(數(shù)據(jù)源類型為鑲?cè)氲臄?shù)據(jù))同時配對每一個輸出標(biāo)簽格/方法2:配置
2、如下/標(biāo)簽test.btw 設(shè)置為數(shù)據(jù)庫(以excel為數(shù)據(jù)庫)同時配對每一個輸出標(biāo)簽格第二部分:界面和代碼using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using Seagull.BarTender.Print;using System;using System.Diagnostics;us
3、ing System.Drawing.Printing;namespace WindowsFormsApplication1 public partial class Form1 : Form public Form1() InitializeComponent(); /useLegacyV2RuntimeActivationPolicy = true;在app.config中添加一個配置節(jié):startup /增加引用,BarTender 10.1 ,Seagull.Bartender.Print 兩個引用 private void button1_Click(object sender, E
4、ventArgs e)/輸入內(nèi)容后選擇打印機 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.SetNamedSubStringValue(StyleNo, this.Styl
5、eNotext.Text); btFormat.SetNamedSubStringValue(HelpCode, this.HelpCodetext.Text); btFormat.SetNamedSubStringValue(ProductCategoryName, this.ProductCategoryNametext.Text); btFormat.SetNamedSubStringValue(MetalPurityName, this.MetalPurityNametext.Text); btFormat.SetNamedSubStringValue(MaterialTypeName
6、, this.MaterialTypeNametext.Text); btFormat.SetNamedSubStringValue(RingSize, this.RingSizetext.Text); btFormat.SetNamedSubStringValue(Weight, this.Weighttext.Text); btFormat.SetNamedSubStringValue(StoneQuantity, this.StoneQuantitytext.Text); btFormat.SetNamedSubStringValue(StoneWeight, this.StoneWei
7、ghttext.Text); btFormat.PrintOut(false,true); private void button3_Click(object sender, System.EventArgs e)/導(dǎo)出execl后調(diào)用模板選擇打印機 BarTender.Application btApp = new BarTender.Application(); BarTender.Format btFormat; btFormat = btApp.Formats.Open(d:test.btw, false, ); /btFormat.PrintSetup.IdenticalCopies
8、OfLabel = 1; /btFormat.PrintSetup.NumberSerializedLabels = 1; /btFormat.SetNamedSubStringValue(StyleNo, RG); /btFormat.SetNamedSubStringValue(HelpCode, ); /btFormat.SetNamedSubStringValue(ProductCategoryName, 戒指); /btFormat.SetNamedSubStringValue(MetalPurityName, S925); /btFormat.SetNamedSubStringVa
9、lue(MaterialTypeName, 鋯石); /btFormat.SetNamedSubStringValue(RingSize, 14ch); /btFormat.SetNamedSubStringValue(Weight, 1.56); /btFormat.SetNamedSubStringValue(StoneQuantity, 33); /btFormat.SetNamedSubStringValue(StoneWeight, 0.123); btFormat.PrintOut(false, true); private void button4_Click(object se
10、nder, System.EventArgs e)/輸入內(nèi)容后指定打印機 Engine btEngine = new Engine(); btEngine.Start(); LabelFormatDocument btFormat = btEngine.Documents.Open(d:test1.btw); /指定打印機名 btFormat.PrintSetup.PrinterName = Argox CP-3140L PPLB; /改變標(biāo)簽打印數(shù)份連載 btFormat.PrintSetup.NumberOfSerializedLabels = 1; /打印份數(shù) btFormat.Prin
11、tSetup.IdenticalCopiesOfLabel = 1; btFormat.SubStringsStyleNo.Value = this.StyleNotext.Text; btFormat.SubStringsHelpCode.Value = this.HelpCodetext.Text; btFormat.SubStringsProductCategoryName.Value = this.ProductCategoryNametext.Text; btFormat.SubStringsMetalPurityName.Value = this.MetalPurityNamete
12、xt.Text; btFormat.SubStringsMaterialTypeName.Value = this.MaterialTypeNametext.Text; btFormat.SubStringsRingSize.Value = this.Weighttext.Text; btFormat.SubStringsWeight.Value = this.StoneQuantitytext.Text; btFormat.SubStringsStoneWeight.Value = this.StoneWeighttext.Text; Messages messages; int waito
13、ut = 10000; / 10秒 超時 Result nResult1 = btFormat.Print(標(biāo)簽打印軟件, waitout, out messages); btFormat.PrintSetup.Cache.FlushInterval = CacheFlushInterval.PerSession; /不保存對打開模板的修改 /btFormat.Close(SaveOptions.DoNotSaveChanges); /結(jié)束打印引擎 btEngine.Stop(); private void button5_Click(object sender, System.EventAr
14、gs e)/導(dǎo)出execl后調(diào)用模板指定打印機 BarTender.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
15、, RG); /btFormat.SetNamedSubStringValue(HelpCode, ); /btFormat.SetNamedSubStringValue(ProductCategoryName, 戒指); /btFormat.SetNamedSubStringValue(MetalPurityName, S925); /btFormat.SetNamedSubStringValue(MaterialTypeName, 鋯石); /btFormat.SetNamedSubStringValue(RingSize, 14ch); /btFormat.SetNamedSubStri
16、ngValue(Weight, 1.56); /btFormat.SetNamedSubStringValue(StoneQuantity, 33); /btFormat.SetNamedSubStringValue(StoneWeight, 0.123); btFormat.PrintOut(false, false); private void button2_Click(object sender, System.EventArgs e)/同一模板選擇打印機/特別說明這里要測試的是同一個模板,先設(shè)置數(shù)據(jù)庫再設(shè)置具名數(shù)據(jù)源的情況下報錯/報錯代碼為 btFormat.SetNamedSubS
17、tringValue(StyleNo, this.StyleNotext.Text); 找不到具名數(shù)據(jù)源/測試之后發(fā)現(xiàn),不能同時支持?jǐn)?shù)據(jù)庫和具名數(shù)據(jù)源兩個配置 this.StyleNotext.Text = ; this.HelpCodetext.Text = ; this.ProductCategoryNametext.Text = 戒指; this.MetalPurityNametext.Text = 18紅黃白; this.MaterialTypeNametext.Text = 爆炸石; this.RingSizetext.Text = 12VI; this.Weighttext.Tex
18、t = 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.SetNamedSubStringValue(StyleNo, this.StyleNotext.Text); btFormat.SetNamedSub
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 12家鄉(xiāng)的喜與憂(教學(xué)設(shè)計)-統(tǒng)編版道德與法治四年級下冊
- 2023七年級數(shù)學(xué)下冊 第三章 變量之間的關(guān)系 3 用圖象表示的變量間關(guān)系第2課時 折線型圖像教學(xué)實錄 (新版)北師大版
- 2024-2025學(xué)年新教材高中生物 第一章 走近細(xì)胞 第2節(jié) 細(xì)胞的多樣性和統(tǒng)一性(2)教學(xué)實錄 新人教版必修1
- 2生活與百分?jǐn)?shù) 第二課時(教學(xué)設(shè)計)-2023-2024學(xué)年六年級下冊數(shù)學(xué)人教版
- 中學(xué)生宿舍樓建設(shè)項目可行性分析
- 2023三年級英語上冊 Unit 5 Let's eat Part A 第二課時教學(xué)實錄 人教PEP
- 12 我們的好朋友 教學(xué)設(shè)計-2023-2024學(xué)年道德與法治四年級下冊統(tǒng)編版
- 7 上課了 教學(xué)設(shè)計-2024-2025學(xué)年道德與法治一年級上冊統(tǒng)編版
- 商務(wù)數(shù)據(jù)分析與應(yīng)用 教案 項目5 數(shù)據(jù)的可視化
- 11 多姿多彩的民間藝術(shù)2023-2024學(xué)年四年級下冊道德與法治同步教學(xué)設(shè)計(統(tǒng)編版)
- 光伏安裝培訓(xùn)課件模板
- 應(yīng)急救援專項方案
- 有機化學(xué)(馮駿材編)課后習(xí)題答案
- 無人機的傳感器系統(tǒng)
- 新法律援助基礎(chǔ)知識講座
- 圖文解讀中小學(xué)教育懲戒規(guī)則(試行)全文內(nèi)容課件模板
- 起重機械安全技術(shù)規(guī)程(TSG-51-2023)宣貫解讀課件
- 《建筑攝影5構(gòu)》課件
- 《無塵室基礎(chǔ)知識》課件
- 2024虛擬電廠管理規(guī)范
- 供應(yīng)商體系稽核表QSA-Checklist
評論
0/150
提交評論