C#調(diào)用bartender打印標(biāo)簽配置和測試說明_第1頁
C#調(diào)用bartender打印標(biāo)簽配置和測試說明_第2頁
C#調(diào)用bartender打印標(biāo)簽配置和測試說明_第3頁
C#調(diào)用bartender打印標(biāo)簽配置和測試說明_第4頁
C#調(diào)用bartender打印標(biāo)簽配置和測試說明_第5頁
已閱讀5頁,還剩2頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論