How could Printer Code Template Field passed data correctly form c# with .NET SDK? 追蹤


 I write a demo to test Printer Code Template Filed for passing data from c#  with .NET SDK. 

Bartender Desinger version is (32-bit).

Here is my test code and  lable template. 

var lb = @"C:\Users\Administrator\Desktop\线标.btw";
using (Engine engine = new Engine(true))

LabelFormatDocument btformate = engine.Documents.Open(lb);
btformate.SubStrings["version"].Value = txtVersion.Text;
btformate.SubStrings["pn"].Value = txtPN.Text;
btformate.SubStrings["sn"].Value = txtsn.Text;
btformate.SubStrings["week"].Value = txtWeek.Text;

btformate.PrinterCodeTemplate.Performance.AllowVariableDataOptimization = true;

btformate.ExportImageToClipboard(Seagull.BarTender.Print.ColorDepth.ColorDepth256, new Resolution(200));

I mean to pass data from c# with string formate,but Bartender regard it as numper and  add ','  or '.00'

How can I adjust my template for passing string instead of number? i can't find any option for that.

Thanks a lot.



2 意見

Ye Zhao
評論操作 永久連結

Anyone can help? Thanks~

評論操作 永久連結

Personally , I recommend dictionary or something close.

Like add pair of string into a dictionary with key (source) and value , then SetSubString with foreach like below

foreach (var node in Dictionay)
     btformat.SubStrings.SetSubString(node.Key, node.Value);


Never ran into the problem u've got , so maybe you can try it out.