Bartender substring check
I'm using Lable Print example as base. C#, .NET SDK.
How can I check if a Bartender file contains Substrings (Named Data Sources)? I want to automatically check if chosen lable has "PN", "VN" and "SN" substrings.
I need advice how I can compare the substring object to string.
-
Andy Hurst
★ BarTender Hero ★
Once you open a label with this: LabelFormatDocument currentLabel = engine.Documents.Open(labelPath, PrinterName);
Then currentLabel.Substrings should have all your named substrings. The substring object has a name and value property.1 -
Kardo Aia
★ BarTender Hero ★
Hi Andy,
Yes but how do I check that substring exists?
If I run
format.SubStrings["SN"].Value
And named data source "SN" doesn't exist in the lable then what answer do I get?
I'm trying to automate as much as possible and in this case tring to eliminate the danger that when lable format changes and named data sources (if we receive lable files from client, they don't have them) aren't created for new version then the program doesn't allow it to be used.
0 -
Lubin Chen
★ BarTender Hero ★
bool found = false;
foreach (var btSubString in btFormat.SubStrings)
{
if (btSubString.Name == "SN")
{
found = true;
break;
}
}0
請登入寫評論。
評論
3 條評論