NamedSubStrings.SetAll Method |
Sets all data sources using a string that contains the name and value separated by a delimiter.
NamedSubStrings.SetAll(String, Delimiter)
Where
String is a string containing the value to which all data sources will be set.
Delimiter is the character(s) used to separate the name and value of each name/value record.
Version |
BarTender 6.00 or higher |
Edition |
Automation, Enterprise |
The NamedSubStrings.SetAll method sets all data sources to a value using a string that contains the name and value separated by a delimiter. This function is more efficient than using the Format.SetNamedSubStringValue method, because it only makes one call to set the data source value as opposed to multiple calls.
The following example sets data source values for Name, Address, and Zip. To do this, we need to format the name and value of each data source into a string delimited by a line feed character:
Name <LineFeed>
Jared Stevens <LineFeed>
Address <LineFeed>
123 Street <LineFeed>
Zip <LineFeed>
98296
'Declare a BarTender application variable
Dim btApp As BarTender.Application
'Declare a BarTender document variable
Dim btFormat As BarTender.Format
'Declare a string variable to store the data source value
Dim btNamedSubString As String
'Create a new instance of BarTender
btApp = New BarTender.Application
'Set the BarTender application visible
btApp.Visible = True
'Open a BarTender document
btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")
'Set the name
btNamedSubString = "Name" & vbLf & "Jared Stevens" & vbLf
'Set the address
btNamedSubString = btNamedSubString & "Address" & vbLf & "123 Street" & vbLf
'Set the zip code
btNamedSubString = btNamedSubString & "Zip" & vbLf & "98296" & vbLf
'Set all of the named data source
btFormat.NamedSubStrings.SetAll(btNamedSubString, vbLf)
'End the BarTender process
btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)
// Declare a BarTender application variable
BarTender.Application btApp;
// Declare a BarTender document variable
BarTender.Format btFormat;
// Declare a string variable to store the data source value
string btNamedSubString;
// Create a new instance of BarTender
btApp = new BarTender.Application();
// Set the BarTender application visible
btApp.Visible = true;
// Open a BarTender document
btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");
// Set the name
btNamedSubString = "Name" + "\r\n" + "Jared Stevens" + "\r\n";
// Set the address
btNamedSubString = btNamedSubString + "Address" + "\r\n" + "123 Street" + "\r\n";
// Set the zip code
btNamedSubString = btNamedSubString + "Zip" + "\r\n" + "98296" + "\r\n";
// Set all of the named data sources
btFormat.NamedSubStrings.SetAll(btNamedSubString, "\r\n");
// End the BarTender process
btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);
Related Topics