Reading Labels Dynamically S’abonner

0
Avatar
Legacy Poster

Hi
I am using Bartender 10 and i would like to use .NET SDK to read the label Field Names (aka named substring) dynamically. I want to open the btw file and list down all the label fields. Whats the API function to do this?

Thanks
Feroz

2 commentaires

0
Avatar
Shotaro Ito
Actions pour les commentaires Permalien

[quote name='Feroz' timestamp='1341394364' post='2761']
I am using Bartender 10 and i would like to use .NET SDK to read the label Field Names (aka named substring) dynamically. I want to open the btw file and list down all the label fields. Whats the API function to do this?
[/quote]

Hi Feroz, That can be done by Substring class. below is extract from Online help, search by "SubString Class" to get the topic.
There is other method to get all pairs of name and value in a string - SubStrings.GetAll Method - which can be faster when you have many substrings.

[code]
public void Demo()
{
// Initialize a new BarTender print engine.
using (Engine btEngine = new Engine())
{
// Start the BarTender print engine.
btEngine.Start();

// Open a format document.
LabelFormatDocument btFormat = btEngine.Documents.Open(@"C:\Format1.btw");

// Display the number of substrings in the format.
Console.WriteLine("SubStrings Count: " + btFormat.SubStrings.Count);

// Iterate through and read each SubString Name, Type and Value.
foreach (SubString substring in btFormat.SubStrings)
{
Console.WriteLine("SubString Name: " + substring.Name
+ ", SubString Type: " + substring.Type
+ ", SubString Value: " + substring.Value);
}

// Set a SubString Value using its index.
btFormat.SubStrings[0].Value = "New SubString Value";

// Set a SubString Value using its name (case sensitive).
btFormat.SubStrings["SubString1"].Value = "New SubString Value";

// Close the current format without saving.
btFormat.Close(SaveOptions.DoNotSaveChanges);

// Stop the BarTender print engine.
btEngine.Stop();
}
}
[/code]
0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Hi, I can get the substring collection of each label in bartender 9.3?

Vous devez vous connecter pour laisser un commentaire.