How could Printer Code Template Field passed data correctly form c# with .NET SDK? フォローする

1
Avatar
Ye Zhao

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

Bartender Desinger version is 11.0.1.3045 (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));
engine.Stop();
}




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 コメント

1
Avatar
Ye Zhao
コメントアクション Permalink

Anyone can help? Thanks~

0
Avatar
Jimmy
コメントアクション Permalink

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.

ログインしてコメントを残してください。