ActiveX Automation Interface

Note: Available only with BarTender Enterprise Edition.

Introduction

BarTender supports ActiveX Automation, exposing its functionality as a set of software objects. Using a programming language, like Visual Basic 6.0, VB.NET, or C#, you can do programmatically most tasks that you can do with BarTender's user interface.

The example code in this help uses VB.NET and C# (although you can use any programming language that supports Microsoft’s automation interface). These topics assume that you are familiar with the BarTender application, with VB.NET or C# syntax, and with .NET.

Note: We recommend that you use the fully qualified names of BarTender objects, as we do in all examples in this help. If you prefer to use the shorter form of the names, you can add a VB.NET "Imports BarTender" (or a C# "using BarTender") command to your program. However, with C#, you will still need to fully qualify references to an Application class as either "BarTender.Application" or "System.Windows.Forms.Application".

Object Model

BarTender’s object model closely resembles BarTender’s user interface. For example, the top level Application object represents BarTender application itself, and the Format object represents an open format file.

SEE ALSO:

ActiveX Automation Alphabetic Keyword List

ActiveX Automation Properties List

ActiveX Automation Methods List

ActiveX Automation Objects Model

Using Visual Basic 6.0

Using the Application Object

Using the Format Object

Using the Window Object

Using the PrinterCodeTemplate Object

Opening a Label Format File

Saving Formats

Printing Formats

Automating Database Printing

Changing Text and Bar Code Data

Exporting Formats to Printer Code Templates


Using Visual Basic 6.0

All of the examples in this help are for VB.NET or C#. If you are using Visual Basic 6.0, you will have to adapt the VB.NET examples to the Visual Basic 6.0 syntax. Here are some general points to keep in mind:

The Application object is a top level object in BarTender hierarchy. It references other BarTender objects and can be used to set application wide options.

To access the Application object from Visual Basic, you must perform the following steps.

  1. Set a reference to the BarTender application.

This can be done from Visual Basic by selecting References from the Project menu, and selecting BarTender from the Available References list box. If you are using Visual Basic for Applications (i.e. supported by Microsoft Office Suite and other programs), the References dialog can be found in the Tools menu.

  2. Declare an object variable of type BarTender.Application using the Dim command.

  3. Start a new BarTender, or access a running BarTender, by creating (or getting) a reference to the BarTender Application object and setting it to the object variable defined in the step above.

  4. Quit the BarTender application using the Quit method of the Application object.

For example, the following Visual Basic 6.0 code will start a new copy of BarTender and quit.

Dim btApp As BarTender.Application

Set btApp = CreateObject("BarTender.Application")

btApp.Quit

If you would like to reference a BarTender application that is already running then use the GetObject function in place of the CreateObject function.

Now that you have an application object with which to work, you can set many of its properties to control the global behavior of BarTender. For example, the following code makes BarTender visible after it has been started.

Dim btApp As BarTender.Application

Set btApp = CreateObject("BarTender.Application")

btApp.Visible = true

Other properties, methods, and objects of the Application object allow you to:

  • Access other objects in BarTender hierarchy.

  • Save all open formats (using the Save method).

  • Enter ODBC, or OLE DB, user ID and password information.

  • Manage the BarTender application window (represented by the Window object).

  • Export a Printer Code Template instead of printing.

SEE ALSO:

Using the Format Object

Using the Window Object

Using the PrinterCodeTemplate Object


Object Model

Shown here is the structure of the object model for BarTender. For more information about an object or collection, click on its name.

SEE ALSO:

ActiveX Automation Alphabetic Keyword List

ActiveX Automation Properties List

ActiveX Automation Methods List


Using the Application Object

The BarTender.Application object is a top level object in BarTender hierarchy. It references other BarTender objects and can be used to set application wide options.

To access the BarTender.Application object, you must perform the following steps.

  1. Set a reference to the BarTender application.

This can be done in Visual Studio by opening the Add Reference dialog (see the VS help). Open the COM tab. In the list of COM interfaces, select BarTender 7.75 and then click OK.

  2. Declare an object variable of type BarTender.Application using the Dim command.

  3. Instantiate a BarTender application object and assign it to the object variable defined in the step above using the new operator and the constructor BarTender.ApplicationClass().

  4. Quit the BarTender application using the Quit method of the BarTender.Application object.

Note: We recommend that you use the fully qualified names of BarTender objects, as we do in all examples in this help. If you prefer to use the shorter form of the names, you can add a VB.NET "Imports BarTender" (or a C# "using BarTender") command to your program. However, with C#, you will still need to fully qualify references to an Application class as either "BarTender.Application" or "System.Windows.Forms.Application".

For example, the following VB.NET code will start a new copy of BarTender and quit.

'Declaring a BarTender application variable

Dim btApp As BarTender.Application

'Instantiating the BarTender object

btApp = New BarTender.ApplicationClass()

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

The same thing is done in C# in this example:

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instatiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

In VB.NET, if you would like to reference a BarTender application that is already running, then use the GetObject function:

btApp = GetObject(, "BarTender.Application")

In C#, use the .NET method System.Runtime.InteropServices.Marshal.GetActiveObject():

//Assigning the running BarTender to an object variable object btObject = System.Runtime.InteropServices.Marshal.GetActiveObject("BarTender.Application");

//Converting the variable to a BarTender application variable
BarTender.Application btApp = btObject as BarTender.Application;

Now that you have an application object with which to work, you can set many of its properties to control the global behavior of BarTender. For example, the following code makes BarTender visible after it has been started.

btApp.Visible = True

[When using C#, add a semi-colon to the end and lower case "true."]

Other properties, methods, and objects of the BarTender.Application object allow you to:

  • Access other objects in BarTender hierarchy.

  • Save all open formats (using the Save method).

  • Manage BarTender application window (represented by the Window object).

  • Export a printer code template instead of printing.

SEE ALSO:

Using the Format Object

Using the Window Object

Using the PrinterCodeTemplate Object


Using the Window Object

BarTender’s appearance can be controlled using the Application object’s Window object.

The following examples set the size of BarTender application window on the screen.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the window state property

btApp.Window.WindowState = BarTender.BtWindowState.btNormal

'Setting the height property

btApp.Window.Height = 400

'Setting the width property

btApp.Window.Width = 650

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the window state property

btApp.Window.WindowState = BarTender.BtWindowState.btNormal;

//Setting the height property

btApp.Window.Height = 400;

//Setting the width property

btApp.Window.Width = 650;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

SEE ALSO:

Using the Application Object

Using the Format Object

Using the PrinterCodeTemplate Object


Using the Format Object

Whenever a label format is opened or created a Format object is created. The Format object can be used to open, save, print, change database options, and modify text and bar code data.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Printing the label format

btFormat.PrintOut(False, False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "")

//Printing the label format

btFormat.PrintOut(false, false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

SEE ALSO:

Using the Application Object

Using the Window Object

Using the PrinterCodeTemplate Object


Using the PrinterCodeTemplate Object

A PrinterCodeTemplate object can be used to configure and export a printer code template. You can also use it to export a pair of templates; one holding all the label formatting and the other holding the variable data fields.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender messages variable to hold all messages

Dim btMessages As BarTender.Messages

'Declaring a variable for holding message text

Dim ExportSuccess As Boolean

'Declaring a success variable

Dim btMessageText As String

'Declaring loop counter

Dim i As Integer

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Exporting the printer code template

ExportSuccess = btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Checking to see if there is an error message

If ExportSuccess = False Then

'Looping through the messages

For i = 1 To btMessages.Count

'Populating error messages into a string

btMessageText = btMessageText & btMessages.GetMessage(i).Severity & vbCrLf & btMessages.GetMessage(i).Number _
& " " & btMessages.GetMessage(i).Message

Next i

'Display the problem with exporting the printer code

MessageBox.Show("Export Failed. Errors and Warnings: " & btMessageText)

Else

'Looping through the messages

For Each btMessage In btMessages

'Populating warning messages into a string

btMessageText = btMessageText & vbCrLf & btMessage.Severity & " " & btMessage.Number & " " & btMessage.Message

Next

'Display the problem with exporting the printer code

MessageBox.Show("Export Failed. Errors and Warnings: " & btMessageText)

End If

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring a variable for holding message text

string btMessageText = "";

//Declaring a sucess variable

bool ExportSuccess;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Exporting the printer code template

ExportSuccess = btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate,
"c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn",
ref obj);

//Setting the message variable to the object

btMessages = obj as BarTender.Messages;

//Checking to see if there is an error message

if (ExportSuccess == false)

{

//Looping through the messages

for (int i = 1; i <= btMessages.Count; i++)

{

//Populating error messages into a string

        btMessageText += "\r\n" +
btMessages.GetMessage(i).Severity + "\r\n" + btMessages.GetMessage(i).Number+
"\r\n" + btMessages.GetMessage(i).Message;

}

//Display the problem with exporting the printer code

MessageBox.Show("Export failed. Errors and Warnings: " + btMessageText);

}

else

{

//Looping through the messages

foreach (BarTender.Message btMessage in btMessages)

{

//Populating warning messages into a string

btMessageText += "\r\n" + btMessage.Severity + "\r\n" + btMessage.Number +
"\r\n" + btMessage.Message;

}

//Display the problem with exporting the printer code

MessageBox.Show("Export succeeded. Warnings: " + btMessageText);

}

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

SEE ALSO:

Using the Application Object

Using the Window Object

Using the Format Object


Automating Database Printing

BarTender can be configured such that data can be read from one or more text files, ODBC databases, and OLE DB databases. The characteristics of the database can be configured using the Databases collection object, which is a property of the Format object.

The Databases collection object is a list of individual databases. Each database has the property objects: ODBC, OLEDB, and TextFile. Each is used to set options specific to a database of that type that is connected to a label format.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Setting the database to demo.dat

btDb.TextFile.FileName = "c:\Demo.dat"

'Printing the label format

btFormat.PrintOut(False, False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "")

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Setting the database to demo.dat

btDb.TextFile.FileName = "c:\\Demo.dat";

//Printing the label format

btFormat.PrintOut(false, false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

If you have configured your label format using an ODBC or OLE DB database, you can change the SQL statement used to perform record selection by setting the SQLStatement property of the ODBC or OLEDB object. For an example, see SQL Select Statement.

Note: You can also export a Printer Code Template and then have a print system fill in the variable data.

SEE ALSO:

Saving Formats

Printing Formats

Changing Text and Bar Code Data On The Label


Changing Text and Bar Code Data On The Label

To change the text and/or bar code data on the label you can use the SetNamedSubStringValue method for a Format object. SetNamedSubStringValue has two arguments. The first argument takes the name of the substring you want to modify. You can only modify a substring with a Screen Data data source. The second argument is the new data string you want the substring to become.

The following Visual Basic example shows how to change the product name and id on the Demo.btw label format and then print it.

'Declare object variables
Dim btApp As BarTender.Application
Dim btFormat As BarTender.Format

'Start the Bar Tender application
Set btApp = CreateObject("BarTender.Application")
btApp.Visible = true

'Open the Demo.btw format file
Set btFormat = btApp.Formats.Open("c:\Demo.btw")

'Set the product name and id on the label.
btFormat.SetNamedSubStringValue "ProductName", "Bar Tender Integration Edition"
btFormat.SetNamedSubStringValue "ProductId", "BtInt98234"

'Print the label
btFormat.PrintOut

btApp.Quit

If you want to access the value of a named substring you can use the GetNamedSubStringValue method of the Format object. The following example displays a message box showing the contents of the ProductName substring.

MsgBox btFormat.GetNamedSubStringValue("ProductName")

Alternatively, you can set and get the values of named substrings by using the NamedSubStrings collection object. By using the NamedSubStrings collection you can set and get values from all of the named substrings.

The following Visual Basic example shows how to use the NamedSubStrings collection object.

'Declare object variables
Dim btApp As BarTender.Application
Dim btFormat As BarTender.Format
Dim btSubString As BarTender.SubString

'Start the Bar Tender application
Set btApp = CreateObject("BarTender.Application")
btApp.Visible = true

'Open the Demo.btw format file
Set btFormat = btApp.Formats.Open("c:\Demo.btw")

'Display the name and value of all substrings.
For Each btSubString In btFormat.NamedSubStrings

MsgBox "Name is: " & btSubString.Name & vbCrLf & "Value is: " & btSubString.Value

Next

btApp.Quit

SEE ALSO:

SetNamedSubStringValue Method

GetNamedSubStringValue Method

NamedSubStrings Collection Object

SubString Object


Opening a Label Format File

BarTender application can open many different label format files. The management of these formats is handled by using the Formats collection object, which is a list of Format objects. The following example shows how you can open and return a reference to the opened Format object.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format to variable

DDim btFormat1 As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat1 = btApp.Formats.Open("c:\Format1.btw", False, "")

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat1;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat1 = btApp.Formats.Open("c:\\Format1.btw", false, "");

The Open method has three arguments. The first argument is required and is the label format file to open. The second argument is a Boolean: if it is true, the method will close the default blank format called "Format1" that BarTender automatically opens when it starts. (It cannot close formats that have any other name.) The third argument specifies a printer to use.

If you have multiple formats opened in BarTender you can use the Formats collection object to return a reference to any opened format by specifying either the format name or index identifier. You can also activate an opened label format file by using the Activate method.

VB.NET Example

'Setting the BarTender format to open

btFormat1 = btApp.Formats.Open("c:\Format1.btw", False, "")

'Giving focus to the opened format

btFormat1.Activate()

C# Example

//Setting the BarTender format to open

btFormat1 = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Giving the BarTender format to open

btFormat1.Activate();

SEE ALSO:

Saving Formats

Printing Formats

Automating Database Printing

Changing Text and Bar Code Data On The Label


Printing Formats

To print a label format, use the PrintOut method of a Format object.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Printing the label format

btFormat.PrintOut(False, False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "")

//Printing the label format

btFormat.PrintOut(false, false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

The PrintOut method has two optional Boolean arguments. The first argument, if set true, will display a print job status dialog. The second argument, if set true, will display the print dialog, where the user can change the printer and other print settings.

The following Format object properties can be set to configure print options prior to calling the PrintOut method.

AutoPrintAgain

EnablingPrompting

PrintToFile

RecordRange

SelectRecordsAtPrint

UseDatabase

SEE ALSO:

Opening a Label Format File

Saving Formats

Automating Database Printing

Changing Text and Bar Code Data On The Label

Exporting Formats to Printer Code Templates


Saving Formats

You can save a format by using the Save or SaveAs methods of the Format object. The following example will open the Demo.btw label format file, turn off printing to a file, save the format, turn on printing to a file, and then save the format as a different label format file called DemoToFile.btw.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the PrintToFile property

btFormat.PrintToFile = False

'Saving the label format

btFormat.Save()

'Setting the PrintToFile property

btFormat.PrintToFile = True

'Saving the label format out as a different name

btFormat.SaveAs("c:\DemoToFile.btw", True)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "")

//Setting the PrintToFile property

btFormat.PrintToFile = false;

//Saving the label format

btFormat.Save();

//Setting the PrintToFile property

btFormat.PrintToFile = true;

//Saving the label format out as a different name

btFormat.SaveAs("c:\\DemoToFile.btw", true);

The Save method takes no arguments, whereas the SaveAs method takes two arguments. The first argument is the file to save to and is required. The second argument is a Boolean that, if true, will overwrite the file if it exists, and if false will return an error if the file exists. The second argument is optional.

SEE ALSO:

Opening a Label Format File

Printing Formats

Automating Database Printing

Changing Text and Bar Code Data On The Label

Exporting Formats to Printer Code Templates


Exporting a Format to a Printer Code Template

Use the Export method of the PrinterCodeTemplate object to export a printer code template.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender messages variable to hold all messages

Dim btMessages As BarTender.Messages

'Declaring a variable for holding message text

Dim ExportSuccess As Boolean

'Declaring a success variable

Dim btMessageText As String

'Declaring loop counter

Dim i As Integer

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Exporting the printer code template

ExportSuccess = btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Checking to see if there is an error message

If ExportSuccess = False Then

'Looping through the messages

For i = 1 To btMessages.Count

'Populating error messages into a string

btMessageText = btMessageText & btMessages.GetMessage(i).Severity & vbCrLf & btMessages.GetMessage(i).Number _
& " " & btMessages.GetMessage(i).Message

Next i

'Display the problem with exporting the printer code

MessageBox.Show("Export Failed. Errors and Warnings: " & btMessageText)

Else

'Looping through the messages

For Each btMessage In btMessages

'Populating warning messages into a string

btMessageText = btMessageText & vbCrLf & btMessage.Severity & " " & btMessage.Number & " " & btMessage.Message

Next

'Display the problem with exporting the printer code

MessageBox.Show("Export Failed. Errors and Warnings: " & btMessageText)

End If

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring a variable for holding message text

string btMessageText = "";

//Declaring a sucess variable

bool ExportSuccess;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Exporting the printer code template

ExportSuccess = btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate,
"c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn",
ref obj);

//Setting the message variable to the object

btMessages = obj as BarTender.Messages;

//Checking to see if there is an error message

if (ExportSuccess == false)

{

//Looping through the messages

for (int i = 1; i <= btMessages.Count; i++)

{

//Populating error messages into a string

        btMessageText += "\r\n" +
btMessages.GetMessage(i).Severity + "\r\n" + btMessages.GetMessage(i).Number+
"\r\n" + btMessages.GetMessage(i).Message;

}

//Display the problem with exporting the printer code

MessageBox.Show("Export failed. Errors and Warnings: " + btMessageText);

}

else

{

//Looping through the messages

foreach (BarTender.Message btMessage in btMessages)

{

//Populating warning messages into a string

btMessageText += "\r\n" + btMessage.Severity + "\r\n" + btMessage.Number +
"\r\n" + btMessage.Message;

}

//Display the problem with exporting the printer code

MessageBox.Show("Export succeeded. Warnings: " + btMessageText);

}

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

SEE ALSO:

Opening a Label Format File

Saving Formats

Printing Formats

Automating Database Printing

Changing Text and Bar Code Data On The Label


Application Object

Description

Top level object for BarTender. Used to access and set top-level attributes and to get the rest of BarTender object model.

User Interface Representation: BarTender Application and all its open formats.

See also, Using the Application Object.

Properties

The following properties are supported:

Property | Description
ActiveFormat | Activates the format as the active window.
BuildNumber | Returns the build number.
IsPrinting | Returns the state of label format printing.
IsProcessingCommandLine | Returns the state of command line processing.
LicenseServer | Returns a reference to the LicenseServer object.
SAPIDocDefinitionFile | Sets and returns the SAP IDoc configuration filename.
Version | Returns the version of BarTender application.
Visible | Sets and returns the visible state of BarTender application.
Window | Returns the Window object.

Methods

The following methods are supported:

Method | Description
Quit | Quits BarTender application.
Save | Saves all opened label formats.

Collections

The following collections are supported:

Collection | Description
Formats | Manages the list of open formats in BarTender. Used to create and open label formats.


Quit Method

Description

Quits BarTender application.

Syntax

object.Quit (BtSaveOptions)

The Quit method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtSaveOptions | Optional in VB, otherwise required. Any of the BtSaveOptions constants. See below.

Settings

The BtSaveOptions argument can have either of the following settings:

Constant | Value | Description
BtPromptSave | 0 | Will prompt the user to save changes if needed. (default)
BtDoNotSaveChanges | 1 | Do not save any changes.
BtSaveChanges | 2 | Save all changes. Do not prompt the user.

Remarks

The Quit method quits and exits BarTender application. All opened formats are saved or not saved based on the BtSaveOptions constant.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Application

SEE ALSO:

Using the Application Object


Save Method (Application)

Description

Saves all opened label formats.

Syntax

object.Save (DoPrompt)

The Save method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
DoPrompt | Optional in VB, otherwise required. Boolean. If true and changes have been made, then you will prompted to save changes. If false, all changes will be saved without displaying a prompt.

Remarks

The Save method saves all opened label formats. If DoPrompt is true and changes have been made, then you will be prompted to save changes. If DoPrompt is false, all changes will be saved without displaying a prompt.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Saving BarTender and not prompting

btApp.Save(False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Saving BarTender and not prompting

btApp.Save(false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Application

SEE ALSO:

Save Method (Format Object)

SaveAs Method

SaveAsVersion Property

Using the Application Object


ActiveFormat Property

Description

Returns a reference to the label format whose window currently has focus.

Access

Read Only

Syntax

object.ActiveFormat

The ActiveFormat property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The ActiveFormat property returns a reference to the label format whose window currently has focus. The property's value is changed with the Activate Method.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat1 As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat1 = btApp.Formats.Open("c:\Format1.btw", False, "")

'Displaying the active format file name

MessageBox.Show(btApp.ActiveFormat.FileName)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat1;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat1 = btApp.Formats.Open("c:\Format1.btw", false, "");

//Displaying the active format file name

MessageBox.Show(btApp.ActiveFormat.FileName);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Application

SEE ALSO:

Activate Method


BuildNumber Property

Description

Returns the build number of the BarTender application.

Access

Read Only

Syntax

object.BuildNumber

The BuildNumber property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The BuildNumber returns the current build number of BarTender application.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Displaying the BarTender build number

MessageBox.Show(btApp.BuildNumber.ToString)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Displaying the BarTender build number

MessageBox.Show(btApp.BuildNumber.ToString());

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Application

SEE ALSO:

Using the Application Object

Version Property


IsPrinting Property

Description

Returns the state of label format printing.

Access

Read Only

Syntax

object.IsPrinting

The IsPrinting property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The IsPrinting property returns true if BarTender is currently printing. This property is useful if BarTender has been queued with several print jobs using command line parameters.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Checking to see if BarTender is printing

if btApp.IsPrinting = true then

'Message box if printing

MessageBox.Show("BarTender is printing")

else

'Message box if not printing

MessageBox.Show("BarTender is not printing")

end if

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Checking to see if BarTender is printing

if (btApp.IsPrinting == true)

{

//Message box if printing

MessageBox.Show("BarTender is printing");

}

else

{

//Message box if not printing

MessageBox.Show("BarTender is not printing");

}

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Application


IsProcessingCommandLines Property

Description

Returns the state of command line processing.

Access

Read Only

Syntax

object.IsProcessingCommandLines

The IsProcessingCommandLines property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The IsProcessingCommandLines property returns true if BarTender is currently processing command lines. This property is useful if BarTender has been queued with several print jobs using command line parameters.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Checking to see if BarTender is processing command lines

if btApp.IsProcessingCommandLines = true then

'Message box if processing command lines

MessageBox.Show("BarTender is processing command lines")

else

'Message box if not processing command lines

MessageBox.Show("BarTender is not processing command lines")

end if

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Checking to see if BarTender is processing command lines

if (btApp.IsProcessingCommandLines == true)

{

//Message box if processing command lines

MessageBox.Show("BarTender is processing command lines");

}

else

{

//Message box if not processing command lines

MessageBox.Show("BarTender is not processing command lines");

}

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Application

SEE ALSO:

Using the Application Object


LicenseServer Property

Description

Returns the LicenseServer object.

Access

Read Only

Syntax

object.LicenseServer

The LicenseServer property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The LicenseServer property returns a reference to BarTender’s LicenseServer object, which is used to communicate with the computer running the Seagull License Server.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the license server port property

btApp.LicenseServer.Port = 5160

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the license server port property

btApp.LicenseServer.Port = 5160;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Application

SEE ALSO:

Using the Application Object


SAPIDocDefinitionFile Property

Description

Sets and returns the SAP IDoc configuration filename.

Access

Read/Write

Syntax

object.SAPIDocDefinitionFile[=FileName]

The SAPIDocDefinitionFile property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
FileName | Required. The name of the SAP IDoc configuration file to use.

Remarks

The SAPIDocDefinitionFile property sets and returns the name of the SAP IDoc configuration file to use.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Set the SAP IDoc configuration file name

btApp.SAPIDocDefinitionFile = "c:\\config.icf"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Set the SAP IDoc configuration file name

btApp.SAPIDocDefinitionFile = "c:\\config.icf";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Application

SEE ALSO:

Using the Application Object


Version Property

Description

Returns the version of BarTender application.

Access

Read Only

Syntax

object.Version

The Version property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Version property returns the current version of BarTender application.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Displaying the BarTender version number

MessageBox.Show(btApp.Version.ToString)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Displaying the BarTender version number

MessageBox.Show(btApp.Version.ToString());

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Application

SEE ALSO:

Using the Application Object

BuildNumber Property


Visible Property

Description

Sets and returns whether or not the BarTender application will be visible when it runs.

Access

Read/Write

Syntax

object.Visible [=true|false]

The Visible property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Required. If true, BarTender application will be visible.

Remarks

If true, BarTender application will be visible. If false, BarTender application will run in the background.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Application

SEE ALSO:

Using the Application Object


Window Property

Description

Returns a reference to the Window object.

Access

Read Only

Syntax

object.Window

The Window property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Window property returns a reference to BarTender’s Window object, which is used to control the appearance of BarTender application.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the window state property

btApp.Window.WindowState = BarTender.BtWindowState.btMaximize

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the window state property

btApp.Window.WindowState = BarTender.BtWindowState.btMaximize;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Application


Formats Collection Object

Description

Manages the list of open formats in BarTender. Used to create and open label formats.

Properties

The following properties are supported:

Property | Description
Count | Returns the number of opened label formats.

Methods

The following methods are supported:

Method | Description
Add | Creates a new label format.
GetFormat | Returns a reference to a specified Format object.
Item | Returns a reference to a specified Format object.
Open | Opens a label format.

SEE ALSO:

Format Object


Cache Object

Description

The Cache object enables flushing of the printer's memory cache and can set the frequency of automatic flushing.

Properties

The following properties are supported:

Property | Description
FlushInterval | Sets and returns how frequently the cache is automatically flushed.

Methods

The following methods are supported:

Method | Description
Flush | Flushes the printer's memory cache.


FlushInterval Property

Description

Sets and returns the frequency with which the printer's memory cache is automatically flushed.

Access

Read/Write

Syntax

object.FlushInterval [=BtCacheFlushInterval]

The FlushInterval property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtCacheFlushInterval | Required. Must be one of the BtCacheFlushInterval constants. See below.

Settings

The BtCacheFlushInterval argument can be any of these settings:

Constant | Value | Description
btCacheFlushPerSession | 0 | Cache is flushed at beginning of the first print job of each BarTender session.
btCacheFlushDaily | 1 | Cache is flushed at beginning of first print job in the first BarTender session of each day.
btCacheFlushWeekly | 2 | Cache is flushed at beginning of first print job in the first BarTender session of each week.
btCacheFlushMonthly | 3 | Cache is flushed at beginning of first print job in the first BarTender session of each month.
btCacheFlushNever | 4 | Cache is never flushed unless the Flush method is used.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Declaring the BarTender cache variable

Dim btCache As BarTender.Cache

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Setting the cache variable

btCache = btFormat.Cache

'Setting the flush interval property

btCache.FlushInterval = BarTender.BtCacheFlushInterval.btCacheFlushDaily

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Declaring the BarTender cache variable

BarTender.Cache btCache;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Selecting the cache variable

btCache = btPrintSetup.Cache;

//Setting the flush interval property

btCache.FlushInterval = BarTender.BtCacheFlushInterval.btCacheFlushDaily;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Cache

SEE ALSO:

Flush Method


Flush Method

Description

Flushes the printer's memory cache.

Syntax

object.Flush

The Flush method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Declaring the BarTender cache variable

Dim btCache As BarTender.Cache

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Setting the cache variable

btCache = btFormat.Cache

'Flushing the cache

btCache.Flush

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Declaring the BarTender cache variable

BarTender.Cache btCache;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Selecting the cache variable

btCache = btPrintSetup.Cache;

//Flushing the cache

btCache.Flush();

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Cache

SEE ALSO:

FlushInterval Property


Database Object

Description

A Database object represents a database set up in an opened label format.

Properties

The following properties are supported:

Property | Description
Name | Returns the database name.
ODBC | The ODBC object represents an ODBC Data Source database.
OLEDB | The OLEDB object represents an OLE DB Data Source.
SAPIDoc | The SAPIDoc object represents a SAP IDoc Data Source database.
TextFile | The TextFile object represents a text file database.
Type | Returns the type of database to use.

SEE ALSO:

Automating Database Printing

Databases (collection)


Name Property (Database)

Description

Sets and returns the database name.

Access

Read/Write

Syntax

object.Name [= Value]

The Name property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Value | Optional in VB, otherwise required. A name for the database.

Remarks

The Name property sets and returns the name for a database.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Show the database's name

MessageBox.Show(btDb.Name)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Show the database's name

MessageBox.Show(btDb.Name);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Database

SEE ALSO:

Databases Collection Object

Automating Database Printing


ODBC Property

Description

Returns the ODBC object.

Access

Read Only

Syntax

object.ODBC

The ODBC property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The ODBC property returns a reference to the ODBC object.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Setting the user ID

btDb.ODBC.UserId = "Administrator"

'Setting the password

btDb.ODBC.Password = "12345"

'Setting the SQL statement

btDb.ODBC.SQLStatement = "SELECT * FROM 'Customers' WHERE 'Name'='Frank Wild'"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Setting the user ID

btDb.ODBC.UserId = "Administrator";

//Setting the password

btDb.ODBC.Password = "12345";

//Setting the SQL statement

btDb.ODBC.SQLStatement = "SELECT * FROM 'Customers' WHERE 'Name'='Frank Wild'";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Database


OLEDB Property

Description

Returns a reference to the OLEDB object.

Access

Read Only

Syntax

object.OLEDB

The OLEDB property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The OLEDB property returns a reference to the OLEDB object.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Setting the user ID

btDb.OLEDB.UserId = "Administrator"

'Setting the password

btDb.OLEDB.Password = "12345"

'Setting the SQL statement

btDb.OLEDB.SQLStatement = "SELECT * FROM 'Customers' WHERE 'Name'='Frank Wild'"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Setting the user ID

btDb.OLEDB.UserId = "Administrator";

//Setting the password

btDb.OLEDB.Password = "12345";

//Setting the SQL statement

btDb.OLEDB.SQLStatement = "SELECT * FROM 'Customers' WHERE 'Name'='Frank Wild'";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Database


SAPIDoc Property

Description

Returns the SAPIDoc object.

Access

Read Only

Syntax

object.SAPIDoc

The SAPIDoc property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The SAPIDoc property returns a reference to the SAPIDoc object.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Setting the IDoc file name

btDb.SAPIDoc.IDocFileName = "c:\IDD-LIEF03_00108226.ORDERS03_46C"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Setting the IDoc file name

btDb.SAPIDoc.IDocFileName = "c:\\IDD-LIEF03_00108226.ORDERS03_46C";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Database


TextFile Property

Description

Returns the TextFile object.

Access

Read Only

Syntax

object.TextFile

The TextFile property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The TextFile property returns a reference to the TextFile object.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Setting the database to demo.dat

btDb.TextFile.FileName = "c:\Demo.dat"

'Printing the label format

btFormat.PrintOut(False, False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "")

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Setting the database to demo.dat

btDb.TextFile.FileName = "c:\\Demo.dat";

//Printing the label format

btFormat.PrintOut(false, false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Database


Type Property (Database)

Type Property (of Database)

Description

Returns the type of database to use.

Access

Read Only

Syntax

object.Type

The Type property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Settings

The property can return any of the BtInputDataFile constants:

Constant | Value | Description
btTextFile | 0 | The database type is a text file.
btODBC | 1 | The database type is an ODBC data source.
btSAPIdoc | 2 | The database type is a SAP IDoc.
btOLEDB | 3 | The database type is an OLE DB.

Remarks

The following Visual Basic example shows how to use the Type property.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Displaying the type of database being used

MessageBox.Show(btDb.Type.ToString)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring a BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "")

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Displaying the type of database being used

MessageBox.Show(btDb.Type.ToString);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Database

SEE ALSO:

Automating Database Printing


Databases Collection Object

Description

The Databases Collection object manages the list of databases defined for BarTender label format.

Properties

The following properties are supported:

Property | Description
Count | Returns the number of databases.

Methods

The following methods are supported:

Method | Description
GetDatabase | Returns a reference to a specified database object.
Item | Returns a reference to a specified database object.

Collections

The following properties are supported:

Collection | Description
QueryPrompts | The QueryPrompts collection object manages the list of query prompts defined for a BarTender label format.

SEE ALSO:

Database Object


GetDatabase Method

Description

Returns a reference to a specified database object.

Syntax

object.GetDatabase (Index)

The GetDatabase method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Index | Required. Index of the database object. Alternatively, you can use the databases Name property as a string.

Remarks

Use the GetDatabase method to access a specific database that is setup in a BarTender format. Index can be either an integer value or a string specifying the database name. The order of databases in the collection is not guaranteed to be in the order appearing in the database setup of the label. Therefore, we recommend that you reference a database by name, rather than by integer index.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Alternatively, use the database's Name property if it is known

'btDb = btFormat.Databases.GetDatabase("bikes")

'Showing the database name

MessageBox.Show(btDb.Name)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Alternatively, use the database's name if it is known

//btDb = btFormat.Databases.GetDatabase("bikes");

//Showing the database name

MessageBox.Show(btDb.Name);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Databases Collection Object

SEE ALSO:

Automating Database Printing


Item Method (Databases)

Description

Returns a reference to a specified Database object.

Note: This method has the same functionality as the GetDatabase method.

Syntax

object.Item (Index)

The Item method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Index | Required. Index of the Database object. Can be either an integer or string index.

Remarks

Use the Item method to access a specific database that is setup in a BarTender format. Index can be either an integer value or a string specifying the database name. In VB.NET Item is the default method for the databases collection, therefore the Item method does not have to be specified in order to get a reference to a given database object. The database object can be referenced directly using the databases collection. The order of databases in the collection is not guaranteed to be in the order appearing in the database setup of the label. Therefore, we recommend that you reference a database by name, rather than by integer index.

Applies To

Databases Collection Object

SEE ALSO:

Automating Database Printing


Count Property (Databases)

Description

Returns the number of databases.

Access

Read Only

Syntax

object.Count

The Count property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Count property returns the number of databases currently setup in the BarTender format.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Show total number of databases

MessageBox.Show(btFormat.Databases.Count.ToString)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Show the number of databases

MessageBox.Show(btFormat.Databases.Count.ToString());

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Databases Collection

SEE ALSO:

Automating database printing


QueryPrompts (collection)

QueryPrompts Collection Object

Description

The QueryPrompts collection object manages the list of query prompts defined for a BarTender label format.

Properties

The following properties are supported:

Property | Description
Count | Returns the number of query prompts.

Methods

The following methods are supported:

Method | Description
GetQueryPrompt | Returns a reference to a specified QueryPrompt object.
Item | Returns a reference to a specified QueryPrompt object.

SEE ALSO:

Query Prompts Setup Dialog

Databases Collection Object

QueryPrompt Object


Format Object

Description

The Format object represents a label format.

See also, Using the Format Object.

Properties

The following properties are supported:

Property | Description
AutoPrintAgain | Sets and returns the print option to automatically print again.
BaseName | Returns the base name.
Directory | Returns the directory of the label format file.
EnablePrompting | Sets or returns the current setting of the label format option to use an attached database for printing.
FileName | Returns the format's file name.
InputDataFileSetup | Returns a reference to the InputDataFileSetup object.
IdenticalCopiesOfLabel | Sets and returns the number of identical copies of the label.
NumberSerializedLabels | Sets and returns the number of serialized labels to print.
PageSetup | Returns a reference to the PageSetup object.
Printer | Returns the name of the printer.
PrinterCodeTemplate | Returns a reference to the PrinterCodeTemplate object.
PrintSetup | Returns a reference to the PrinterSetup object.
PrinterFile | Sets/Returns the file name to be used when BarTender prints to a file.
PrintToFile | Sets and returns the print to file option.
RecordRange | Sets or returns the record range string that determines which records are printed.
SaveAsVersion | Sets or returns the version of BarTender to which the format will be saved when the Save or SaveAs methods are used.
SelectRecordsAtPrint | Sets or returns the "Select Records At Print Time" flag to prompt the user to select records to be printed.
Title | Returns the title of the label format.
UseDatabase | Sets or returns the current setting of the label format option to use an attached database for printing.

Methods

The following methods are supported:

Method | Description
Activate | Assigns focus to the format's window.
Close | Closes the label format.
ExportToClipboard | Copies a bitmap representation of the label format to the clipboard.
ExportToFile | Creates an image of the label format and saves it to an image file.
GetNamedSubStringValue | Returns the value of a named data substring.
PrintOut | Prints the label format.
Save | Saves the label format.
SaveAs | Saves the label format to a different label format file.
SetNamedSubStringValue | Sets the value of a named data substring.

Collections

The following collections are supported:

Collection | Description
Databases | The Databases Collection object manages the list of databases defined for BarTender label format.
NamedSubStrings | The NamedSubStrings collection object manages the list of named substrings that are assigned to all objects on the label format.

SEE ALSO:

Changing Text and Bar Code Data On The Label


Activate Method

Description

Assigns focus to the format's window.

Syntax

object.Activate

The Activate method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

Makes the format the active format by assigning focus to its window.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat1 as New BarTender.Format

Dim btFormat2 as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Opening a BarTender format

btFormat1 = btApp.Formats.Open("c:\Format1.btw", False, "")

'Opening a second BarTender format

btFormat2 = btApp.Formats.Open("c:\Format2.btw", False, "")

'Setting focus to the opened format

btFormat.Activate()

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat1;

BarTender.Foramt btFormat2;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Opening a BarTender format

btFormat1 = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Opening a second BarTender format

btFormat2 = btApp.Formats.Open("c:\Format2.btw", false, "");

//Setting focus to the opened format

btFormat.Activate();

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format

SEE ALSO:

Using the Format Object

ActiveFormat Property


Close Method

Description

Closes an open label format.

Syntax

object.Close (BtSaveOptions)

The Close method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtSaveOptions | Optional in VB, otherwise required. Any of the BtSaveOptions constants. See below.

Settings

The BtSaveOptions argument can have any of the following settings:

Constant | Value | Description
BtPromptSave | 0 | Will prompt the user to save changes if needed. (default)
BtDoNotSaveChanges | 1 | Do not save any changes.
BtSaveChanges | 2 | Save all changes. Do not prompt the user.

Remarks

The Close method closes an opened label format.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Closing the format and saving changes

btFormat.Close(BarTender.BtSaveOptions.btSaveChanges)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Closing the format and saving changes

btFormat.Close(BarTender.BtSaveOptions.btSaveChanges);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format


ExportToClipboard Method

ExportToClipboard

Description

Copies a bitmap representation of the label format to the clipboard.

Syntax

object.ExportToClipboard (BtColors, BtResolution)

The ExportToClipboard method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtColors | Required. Any of the BtColors constants. See below.
BtResolution | Required. A DPI (dots per inch) value from 50 to 3000 or any of the BtResolution constants. See below.

Settings

The BtColors argument can have any of the following settings:

Constant | Value | Description
btColorsMono | 0 | Use black and white mode.
btColors16 | 1 | Use 16 colors mode.
btColors256 | 2 | Use 256 colors mode.
btColors24bit | 4 | Use 16 million colors mode.

The BtResolution argument can have any of the following settings, or any integer from 50 to 3000 which represents DPI (dots per inch):

Constant | Value | Description
btResolutionScreen | 0 | Use the screen's resolution.
btResolutionPrinter | 1 | Use the format's current printers resolution.

Remarks

The ExportToClipboard method copies the format to the clipboard as a bitmap image. It will make the format the currently selected format within BarTender.

The following Visual Basic example shows how to use the ExportToClipboard method.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Exporting the label format to the clipboard

btFormat.ExportToClipboard(BarTender.BtColors.btColors24Bit, BarTender.BtResolution.btResolutionPrinter)

'Setting the picture object to the clipboard image

PictureBox1.Image = Clipboard.GetDataObject.GetData(DataFormats.Bitmap)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "")

//Exporting the label format to the clipboard

btFormat.ExportToClipboard(BarTender.BtColors.btColors24Bit, BarTender.BtResolution.btResolutionPrinter);

//Setting the picture object to the clipboard image

PictureBox1.Image = Clipboard.GetDataObject.GetData(DataFormats.Bitmap);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format Object

SEE ALSO:

ExportToFile method

Changing Text and Bar Code Data On The Label


ExportToFile Method

Description

Creates an image of the label format and saves it to an image file.

Syntax

object.ExportToFile (FileName, FileType, BtColors, BtResolution, BtSaveOptions)

The ExportToFile method has the following parts:

Part

Description

object

Required. An object expression that evaluates to an object in the Applies To list.

FileName

Required. The full path and filename of the file to create.

FileType

Required. Must be one of the following three-letter strings. Each represents a type of image file (noted in parentheses).

BMP (Windows Bitmap)
PCX (Z Soft PCX/DCX
EPS (Encapsulated Postscript)
JPG (JPEG Image)
DCX (Z Soft PCX/DCX)
TIF (TIFF 5.0 image)

BtColors

Required. Any of the BtColors constants. See below.

BtResolution

Required. A DPI (dots per inch) value from 50 to 3000 or any of the BtResolution constants. See below.

BtSaveOptions

Optional in VB, otherwise required. Any of the BtSaveOptions constants. See below.

Settings

The BtColors argument can have any of the following settings:

Constant | Value | Description
btColorsMono | 0 | Use black and white mode.
btColors16 | 1 | Use 16 colors mode.
btColors256 | 2 | Use 256 colors mode.
btColors24bit | 4 | Use 16 million colors mode.

The BtResolution argument can have any of the following settings, or any integer from 50 to 3000 which represents DPI (dots per inch):

Constant | Value | Description
btResolutionScreen | 0 | Use the screen's resolution.
btResolutionPrinter | 1 | Use the format's current printers resolution.

The BtSaveOptions argument can have any of the following settings:

Constant | Value | Description
BtPromptSave | 0 | Will prompt the user to save changes if needed. (default)
BtDoNotSaveChanges | 1 | Do not save any changes.
BtSaveChanges | 2 | Save all changes. Do not prompt the user.

Remarks

The ExportToFile method copies the format to the clipboard as a bitmap image. It will make the format the currently selected format within BarTender.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Exporting the label format to the a bitmap file

btFormat.ExportToFile("c:\Format1.bmp","BMP" , BarTender.BtColors.btColors24Bit, BarTender.BtResolution.btResolutionPrinter, BarTender.BtSaveOptions.btSaveChanges)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "")

//Exporting the label format to the a bitmap file

btFormat.ExportToFile("c:\\Format1.bmp","BMP" , BarTender.BtColors.btColors24Bit, BarTender.BtResolution.btResolutionPrinter, BarTender.BtSaveOptions.btSaveChanges);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format Object

SEE ALSO:

ExportToClipboard method

Changing Text and Bar Code Data On The Label


GetNamedSubStringValue Method

Description

Returns the value of a named substring.

Syntax

object.GetNamedSubStringValue (SubStringName)

The GetNamedSubStringValue property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
SubStringName | Required. The name of the substring to retrieve.

Remarks

The GetNamedSubStringValue method returns the data value of an object on the label format.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Displaying named substring value

MessageBox.Show(btFormat.GetNamedSubStringValue("ProductName"))

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "")

//Displaying named substring value

MessageBox.Show(btFormat.GetNamedSubStringValue("ProductName"));

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format

SEE ALSO:

Using the Format Object

NamedSubStrings (collection)

SubString Object

GetAll Method


PrintOut Method

Description

The PrintOut method prints the label format.

Syntax

object.PrintOut (ShowStatusWindow, ShowPrintDialog)

The PrintOut property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
ShowStatusWindow | Optional in VB, otherwise required. Boolean. If set true, will display a prompt showing the status of the print job. Default is false.
ShowPrintDialog | Optional in VB, otherwise required. Boolean. If set true, will show the print dialog where printer selection and print options can be set. Default is false.

Remarks

If ShowStatusWindow is true, then a prompt will display showing the status of the print job. If ShowPrintDialog is true, the print dialog will be shown. The PrintOut method returns Ø (type long).

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Printing the label format

btFormat.PrintOut(False, False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "")

//Printing the label format

btFormat.PrintOut(false, false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Formats

SEE ALSO:

Using the Format Object


Save Method (Format)

Description

Saves the label format.

Syntax

object.Save

The Save property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Save method saves the label format.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Saving the label format

btFormat.Save()

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "")

//Saving the label format

btFormat.Save();

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format

SEE ALSO:

Save Method (Application Object)

SaveAs Method

SaveAsVersion Property

Using the Format Object


SaveAs Method

Description

Saves the label format to a different label format file.

Syntax

object.SaveAs (FileName, OverwriteIfExists)

The SaveAs property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
FileName | Required. The new label format file name.
OverwriteIfExists | Optional in VB, otherwise required. Boolean. If true, then overwrite if FileName exists. If false, then an error will occur if FileName exists. The default is false.

Remarks

The SaveAs method saves the label format to a different name.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Saving the label format out as a different name

btFormat.SaveAs("c:\DemoAuto.btw", True)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "")

//Saving the label format out as a different name

btFormat.SaveAs("c:\\DemoAuto.btw", true);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Formats

SEE ALSO:

SaveAsVersion Property

Save Method

Using the Format Object


SetNamedSubStringValue Method

Description

Sets the data of a substring that has been given a share name.

Syntax

object.SetNamedSubStringValue (SubstringName, Value)

The SetNamedSubStringValue property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
SubstringName | Required. Name of substring.
Value | Required. New value for the substring.

Remarks

The SetNamedSubStringValue sets the data of a substring that has been given a share name.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the ProductName substring data

btFormat.SetNamedSubStringValue("ProductName", "Fruit Loops")

'Printing the label format

btFormat.PrintOut(False, False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "")

//Setting the ProductName substring data

btFormat.SetNamedSubStringValue("ProductName", "Fruit Loops")

'Printing the label format

btFormat.PrintOut(false, false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Formats

SEE ALSO:

Using the Format Object

NamedSubStrings (collection)

SubString Object

SetAll Method


AutoPrintAgain Property

Description

Sets and returns the option to automatically print again.

Access

Read/Write

Syntax

object.AutoPrintAgain [={true|false}]

The AutoPrintAgain property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Required. If true, will enable BarTender to print again automatically when a print job is complete.

Remarks

Set this property to true to print again automatically when a print job is complete.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the Auto Print Again property

btFormat.AutoPrintAgain = True

'Printing the label format

btFormat.PrintOut(False, False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the Auto Print Again property

btFormat.AutoPrintAgain = true;

//Printing the label format

btFormat.PrintOut(false, false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format

PrintSetup

SEE ALSO:

Using the Format Object


BaseName Property

Description

Returns the base part of the filename of a label format. This is the filename without the extension (usually ".btw"). Contrast this with the FileName Property.

Access

Read Only

Syntax

object.BaseName

The BaseName property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

Returns the base part of the filename of a label format. This is the filename without the extension (usually ".btw").

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Displaying the base name for the label format

MessageBox.Show(btFormat.BaseName)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Displaying the base name for the label format

MessageBox.Show(btFormat.BaseName);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format

SEE ALSO:

Using the Format Object

FileName Property (for Label Format)


Directory Property

Description

Returns the directory (folder) of the label format file.

Access

Read Only

Syntax

object.Directory

The Directory property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Directory returns the directory (folder) of the label format. It does not include the label format file name.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Displaying the directory of the label format

MessageBox.Show(btFormat.Directory)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "")

//Displaying the directory of the label format

MessageBox.Show(btFormat.Directory);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format

SEE ALSO:

Using the Format Object

FileName Property

BaseName Property


EnablingPrompting Property

EnablingPrompting

Description

Sets or returns whether or not the label format will use an interactive user prompt as the data source at print-time.

Access

Read/Write

Syntax

object.EnablePrompting [=true|false]

The EnablePrompting property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Required. Determines whether the user will be prompted to enter information at print time.

Remarks

The EnablePrompting property provides access to the enable prompting option. Set this property to false to print without user interaction.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the Enable Prompting property

btFormat.EnablePrompting = true

'Printing the label format

btFormat.PrintOut(False, False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "")

//Setting the Enable Prompting property

btFormat.EnablePrompting = true;

//Printing the label format

btFormat.PrintOut(false, false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format

SEE ALSO:

Automating Database Printing

Changing Text and Bar Code Data On The Label


FileName Property (for Label Formats)

Description

Gets the label format's file name.

Access

Read only.

Syntax

object.FileName

The FileName property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The FileName property returns the format's file name.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Displaying the file name for the label format

MessageBox.Show(btFormat.FileName)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Displaying the file name for the label format

MessageBox.Show(btFormat.FileName);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format

SEE ALSO:

Using the Format Object

BaseName Property


InputDataFileSetup Property

Description

Returns a reference to the InputDataFileSetup object.

Access

Read Only

Syntax

object.InputDataFileSetup

The InputDataFileSetup property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The InputDataFileSetup property returns a reference to the InputDataFileSetup object.

Applies To

Format

SEE ALSO:

Using the Format Object


IdenticalCopiesOfLabel Property

Description

Sets and returns the number of identical copies of the label that will print.

Access

Read/Write

Syntax

object.IdenticalCopiesOfLabel [=Value]

The IdenticalCopiesOfLabel property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Value | Required. The number of identical copies to print.

Remarks

The IdenticalCopiesOfLabel specifies the number of copies that you want to print of each label or, when serializing labels, the number of copies of each label in a sequence.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the number of serialized labels

btFormat.IdenticalCopiesOfLabel = 15

'Printing the label format

btFormat.PrintOut(False, False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the number of serialized labels

btFormat.IdenticalCopiesOfLabel = 15;

//Printing the label format

btFormat.PrintOut(false, false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format

PrintSetup

SEE ALSO:

Using the Format Object


NumberSerializedLabels Property

Description

Sets and returns the number of serialized labels to print.

Access

Read/Write

Syntax

object.NumberSerializedLabels [=Value]

The NumberSerializedLabels property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Value | Required. The number of serialized labels to print.

Remarks

The NumberSerializedLabels specifies the desired sequence length when serializing labels.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the number of serialized labels

btFormat.NumberSerializedLabels = 15

'Printing the label format

btFormat.PrintOut(False, False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the number of serialized labels

btFormat.NumberSerializedLabels = 15;

//Printing the label format

btFormat.PrintOut(false, false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format

PrintSetup

SEE ALSO:

Using the Format Object


PageSetup Property

Description

Returns the PageSetup object.

Access

Read Only

Syntax

object.PageSetup

The PageSetup property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The PageSetup property returns a reference to the format's PageSetup object, which holds data about the label stock, page layout, and label size and dimensions.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the label columns

btPageSetup.LabelColumns = 2

'Setting the label rows

btPageSetup.LabelRows = 4

'Setting the label corners round

btPageSetup.LabelCorners = BarTender.BtShape.btRound

'Setting the label height in current units

btPageSetup.LabelHeight(BarTender.BtUnits.btUnitsCurrent) = 6.1

'Setting the label width in current units

btPageSetup.LabelWidth(BarTender.BtUnits.btUnitsCurrent) = 6.1

'Setting the orientation to landscape

btPageSetup.Orientation = BarTender.BtOrientation.btLandscape

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup;

//Setting the label columns

btPageSetup.LabelColumns = 2;

//Setting the label rows

btPageSetup.LabelRows = 4;

//Setting the label corners round

btPageSetup.LabelCorners = BarTender.BtShape.btRound;

//Setting the label height in current units

btPageSetup.LabelHeight(BarTender.BtUnits.btUnitsCurrent) = 6.1f;

//Setting the label width in current units

btPageSetup.LabelWidth(BarTender.BtUnits.btUnitsCurrent) = 6.1f;

//Setting the orientation to landscape

btPageSetup.Orientation = BarTender.BtOrientation.btLandscape;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies tO

Format

SEE ALSO:

PageSetup Object


Printer Property

Description

Sets and returns the name of the printer.

Access

Read/Write

Syntax

object.Printer[=PrinterName]

The Printer property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
PrinterName | Required. Any String.

Remarks

The Printer property sets and returns the name of the printer to which the label is currently assigned. You can also use the Open method to assign a printer to a label format.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Displaying the printer name for the label format

MessageBox.Show(btFormat.Printer)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "")

//Displaying the printer name for the label format

MessageBox.Show(btFormat.Printer);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format

PrintSetup

SEE ALSO:

Using the Format Object


PrinterFile Property

Description

Sets/Returns the file name to be used when BarTender prints to a file.

Access

Read/Write

Syntax

object.PrinterFile[=PrinterFileName]

The PrinterFile property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
PrinterFileName | Required. Any String.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the Print to File property

btFormat.PrintToFile = true

'Setting the location of the print file output

btFormat.PrinterFile = "c:\out.prn"

'Printing the label format

btFormat.PrintOut(False, False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the Print to File property

btFormat.PrintToFile = true;

//Setting the location of the print file output

btFormat.PrinterFile = "c:\\out.prn";

//Printing the label format

btFormat.PrintOut(false, false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format

SEE ALSO:

Using the Format Object


PrinterCodeTemplate Property

Description

Returns a reference to the PrinterCodeTemplate object.

Access

Read Only

Syntax

object.PrinterCodeTemplate

The PrinterCodeTemplate property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The PrinterCodeTemplate property returns a reference to the PrinterCodeTemplate object, which is used to configure and export printer code templates.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender verification variable

Dim btVerification As BarTender.Verification

'Declaring a BarTender messages variable to hold all messages

Dim btMessages As BarTender.Messages

'Declaring a BarTender message variable to hold individual messages

Dim btMessage As BarTender.Message

'Declaring a variable for holding message text

Dim btMessageText As String

'Declaring a success variable

Dim ExportSuccess As Boolean

'Declaring loop counter

Dim i As Integer

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Exporting the printer code template

ExportSuccess = btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Checking to see if there is an error message

If ExportSuccess = False Then

'Looping through the messages

For i = 1 To btMessages.Count

'Getting the error message

btVerification = btMessages.GetMessage(1).Verification

'Populating error messages into a string

btMessageText = btMessageText & btVerification.Problem & vbCrLf & btVerification.Fields & _
" " & btVerification.AutoFix & vbCrLf & btVerification.Result

Next i

'Display the problem with exporting the printer code

MessageBox.Show("Export Failed. Errors and Warnings: " & btMessageText)

Else

'Looping through the messages

For Each btMessage In btMessages

'Getting the error message

btVerification = btMessages.GetMessage(1).Verification

'Populating warning messages into a string

btMessageText = btMessageText & btVerification.Problem & vbCrLf & btVerification.Fields & _
" " & btVerification.AutoFix & vbCrLf & btVerification.Result

Next

'Display the problem with exporting the printer code

MessageBox.Show("Export Failed. Errors and Warnings: " & btMessageText)

End If

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender verification variable

BarTender.Verification btVerification;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring a variable for holding message text

string btMessageText = "";

//Declaring a success variable

bool ExportSuccess;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Exporting the printer code template

ExportSuccess = btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate,
"c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn",
ref obj);

//Setting the message variable to the object

btMessages = obj as BarTender.Messages;

//Checking to see if there is an error message

if (ExportSuccess == false)

{

//Looping through the messages

for (int i = 1; i <= btMessages.Count; i++)

{

//Getting the error message

btVerification = btMessages.GetMessage(1).Verification;

//Populating error messages into a string

btMessageText = btMessageText + btVerification.Problem + "\r\n" + btVerification.Fields +
" " + btVerification.AutoFix + "\r\n" + btVerification.Result;

}

//Display the problem with exporting the printer code

MessageBox.Show("Export failed. Errors and Warnings: " + btMessageText);

}

else

{

//Looping through the messages

foreach (BarTender.Message btMessage in btMessages)

{

//Getting the error message

btVerification = btMessages.GetMessage(1).Verification;

//Populating error messages into a string

btMessageText = btMessageText + btVerification.Problem + "\r\n" + btVerification.Fields + " " + btVerification.AutoFix + "\r\n" + btVerification.Result;

}

//Display the problem with exporting the printer code

MessageBox.Show("Export succeeded. Warnings: " + btMessageText);

}

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format


PrintSetup Property

Description

Returns a reference to the PrintSetup object.

Access

Read Only

Syntax

object.PrintSetup

The PrintSetup property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The PrintSetup property returns a reference to the format's PrintSetup object, which holds data about the printer setup, such as number of copies, name of printer, and number of serialized labels.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Setting the name of the printer property

btPrintSetup.Printer = "HP LaserJet Series II"

'Setting the identical copies of label property

btPrintSetup.IdenticalCopiesOfLabel = 15

'Setting the number of serialized labels property

btPrintSetup.NumberSerializedLabels = 15

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPrintSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "")

//Selecting the print setup variable

btPrintSetup = btFormat.PrintSetup;

//Setting the name of the printer property

btPrintSetup.Printer = "HP LaserJet Series II";

//Setting the identical copies of label property

btPrintSetup.IdenticalCopiesOfLabel = 15 ;

//Setting the number of serialized labels property

btPrintSetup.NumberSerializedLabels = 15;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format

SEE ALSO:

PrintSetup Object


PrintToFile Property

Description

Sets and returns whether or not the label format will be printed to a file.

Access

Read/Write

Syntax

object.PrintToFile [=true|false]

The PrintToFile property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Required. If true, the print job will print to a file. If false, the print job will print to the printer.

Remarks

Set the value to true, if you want to print to a file. Set it to false to print to the printer.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the Print to File property

btFormat.PrintToFile = true

'Setting the location of the print file output

btFormat.PrinterFile = "c:\out.prn"

'Printing the label format

btFormat.PrintOut(False, False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the Print to File property

btFormat.PrintToFile = true;

//Setting the location of the print file output

btFormat.PrinterFile = "c:\\out.prn";

//Printing the label format

btFormat.PrintOut(false, false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format

PrintSetup

SEE ALSO:

Using the Format Object


RecordRange Property

Description

Sets or returns the string that specifies the range of records that will be printed.

Access

Read/Write

Syntax

object.RecordRange [=Range]

The RecordRange property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Range | Required. A string value to set as the record range string.

Remarks

Use the RecordRange property to specify a set of records for printing. Individual records are specified by number and separated by commas as in "1,3,5". A range of numbers indicated with a hyphen can be used to specify a series of consecutive records as in "3-8". The use of parenthesis can be used to specify the number of copies to be printer for each record (e.g. 3(5) will print 5 copies of record 3.

The following Visual Basic example shows how to use the RecordRange property.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the Record Range property

btFormat.RecordRange = "1-3,5(2),6"

'Printing the label format

btFormat.PrintOut(False, False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the Record Range property

btFormat.RecordRange = "1-3,5(2),6";

'Printing the label format

btFormat.PrintOut(false, false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format

SEE ALSO:

Automating Database Printing

SelectRecordsAtPrint Property

Changing Text and Bar Code Data On The Label


SaveAsVersion Property

Description

Sets/returns the version of BarTender to which the format will be saved when the Save or SaveAs methods are used.

Access

Read/Write

Syntax

object.SaveAsVersion[=BtVersion]

The SaveAsVersion property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtVersion | Required. Any of the BtVersion constants. See below.

Remarks

The SaveAsVersion property can be set to any of the following constants:

Constant | Value | Description
btLatest | 0 | Always use the latest version of BarTender (Default)
bt540 | 540 | Use version 5.40
bt541 | 541 | Use version 5.41
bt542 | 542 | Use version 5.42
bt600 | 600 | Use version 6.00
bt610 | 610 | Use version 6.10
bt620 | 620 | Use version 6.20
bt700 | 700 | Use version 7.00
bt710 | 710 | Use version 7.10
bt750 | 750 | Use version 7.50

The methods SaveAs or Save use the SaveAsVersion property to save the label format to a given BarTender version.

The following examples open the Demo.btw label format, sets the SaveAsVersion property, and saves it to the DemoAuto.btw file that can be loaded using BarTender version 5.40.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a format variable

Dim btFormat As New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the version property so that the label can be opened in version 5.40

btFormat.SaveAsVersion = BarTender.BtVersion.bt540

'Save the format as DemoAuto.btw

btFormat.SaveAs("c:\DemoAuto.btw", true)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the version property so that the label can be opened in version 5.40

btFormat.SaveAsVersion = BarTender.BtVersion.bt540;

//Save the format as DemoAuto.btw

btFormat.SaveAs("c:\\DemoAuto.btw", true);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format

SEE ALSO:

SaveAs Method

Save Method

Using the Format Object


SelectRecordsAtPrint Property

Description

Sets or returns whether or not the user will be prompted at print-time to select which records are to be printed.

Access

Read/Write

Syntax

object.SelectRecordsAtPrint[=true|false]

The SelectRecordsAtPrint property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Required. Determines whether records will be selected at print time.

Remarks

When the SelectRecordsAtPrint property is set to true, a Select Records data browser for record selection will be displayed before labels are printed. The Select Records data browser enables the user to select which records to print.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the Select Records at Print property

btFormat.SelectRecordsAtPrint = True

'Printing the label format

btFormat.PrintOut(False, False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the Select Records at Print property

btFormat.SelectRecordsAtPrint = true;

//Printing the label format

btFormat.PrintOut(false, false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format

SEE ALSO:

Automating Database Printing

RecordRange Property

Changing Text and Bar Code Data On The Label


Title Property

Description

Returns the title of the label format.

Access

Read Only

Syntax

object.Title

The Title property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Title returns the format portion of the title bar for the label format. Not necessarily the same as the format file name because if the format has not yet been saved, no format file name will exist.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Displaying the title for the label format

MessageBox.Show(btFormat.Title)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Displaying the title for the label format

btFormat.SelectRecordsAtPrint = true;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format

SEE ALSO:

Using the Format Object


UseDatabase Property

Description

Sets or returns whether or not to use a connected database when printing.

Access

Read/Write

Syntax

object.UseDatabase [=true|false]

The UseDatabase property has the following parts.

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Required. Determines whether a database is used for printing.

Remarks

Set this property to true to print records from a database that has been connected to your label format. This property replaces the obsolete UseInputDataFile property. The following two Visual Basic examples show how to use the UseDatabase property.

VB.NET Examples

Using a PrintSetup Object

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender printsetup variable
Dim btPrintSetup As New BarTender.PrintSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Setting the Use Database property
btPrintSetup.UseDatabase = False

'Printing the label format

btFormat.PrintOut(False, False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

With Format Object

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass()

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the Use Database property
btFormat.UseDatabase = False

'Printing the label format

btFormat.PrintOut(False, False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

Using a PrintSetup Object

//Declaring a BarTender application variable

Dim btApp as BarTender.Application;

//Declaring a BarTender format variable

Dim btFormat as New BarTender.Format;

//Declaring the BarTender printsetup variable

Dim btPrintSetup As New BarTender.PrintSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPrintSetup = btFormat.PrintSetup;

//Setting the Use Database property

btPrintSetup.UseDatabase = false;

//Printing the label format

btFormat.PrintOut(false, false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

With Format Object

//Declaring a BarTender application variable

Dim btApp as BarTender.Application;

//Declaring a BarTender format variable

Dim btFormat as New BarTender.Format;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the Use Database property

btFormat.UseDatabase = false;

//Printing the label format

btFormat.PrintOut(false, false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Format

PrintSetup

SEE ALSO:

Automating Database Printing

Changing Text and Bar Code Data On The Label


NamedSubStrings (collection)

Description

The NamedSubStrings collection object manages the list of named substrings that are assigned to all objects on the label format.

Properties

The following properties are supported:

Property | Description
Count | Returns the number of named substrings.

Methods

The following methods are supported:

Method | Description
GetAll | Returns a string that contains the name and value of all substrings separated by a delimiter.
GetSubString | Returns a reference to a specified SubString object.
Item | Returns a reference to a specified SubString object.
SetAll | Sets all substrings using a string that contains the name and value separated by a delimiter.

SEE ALSO:

SubString Object


Add Method

Description

Creates a new label format.

Syntax

object.Add

The Add method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

Use the Add method to create a new label format.

Applies To

Formats Collection Object

SEE ALSO:

Using the Format Object


GetFormat Method

Description

Returns a reference to a specified Format object.

Syntax

object.GetFormat (Index)

The GetFormat method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Index | Required. Index of Format object to reference. Alternatively, use the format's FileName property as a string.

Remarks

Use the GetFormat method to access a specific label format that is opened in BarTender application. Index can be either an integer value or a string specifying the label format's filename.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Open a format

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Open a second format

btFormat = btApp.Formats.Open("c:\Format2.btw", False, "")

'Selecting the first open format

btFormat = btApp.Formats.GetFormat(1)

'Alternatively, use the format's FileName property if it is known

'btFormat = btFormat.Formats.GetFormat("Format1.btw")

'Setting focus to the opened format

btFormat.Activate()

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Open a format

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Open a second format

btFormat = btApp.Formats.Open("c:\\Format2.btw", false, "");

//Selecting the open format

btFormat = btApp.Formats.GetFormat(1);

//Alternatively, use the format's filename if it is known

//btFormat = btFormat.Formats.GetFormat("Format1.btw");

//Setting focus to the first format

btFormat.Activate();

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Formats Collection Object

SEE ALSO:

Using the Format Object


Item Method (Formats)

Item Method (Format)

Description

Returns a reference to a specified Format object.

Note: This method has the same functionality as the GetFormat method.

Syntax

object.Item (Index)

The Item method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Index | Required. Index of Format object to reference. Can be either an integer or string index.

Remarks

Use the Item method to access a specific label format that is opened in BarTender application. Index can be either an integer value or a string index specifying the label format name. In VB.NET Item is the default method for the Formats collection, therefore the Item method does not have to be specified in order to get a reference to a given Format object. The Format object can be referenced directly using the Formats collection.

Applies To

Formats Collection Object

SEE ALSO:

Using the Format Object


Open Method

Description

The Open method opens a label format. It can also be used to change the format's default printer and to close out the "Format1.btw" format file which opens automatically when BarTender starts.

Syntax

object.Open (Path&FileName CloseOutFirstFormat UsePrinter)

The Open method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Path&FileName | Required. The path and file name of the label format. Wildcards, * and ?, are supported for opening multiple formats.
CloseOutFirstFormat | Optional in VB, otherwise required.. Boolean. If true, will close out the "Format1.btw" file if it exists. The default is false.
UsePrinter | Optional in VB, otherwise required. This parameter specifies an alternate printer for the label format. The default is to use the printer that was selected when the label format was designed or last edited.

Remarks

You can specify a target printer to use for printing by specifying a printer name for the UsePrinter argument. If the UsePrinter argument is left out or is "", then the printer that was selected when the label format was designed or last edited will be used. The UsePrinter argument cannot be left out if you are using C# or a scripting language such as VBScript.

The CloseOutFirstFormat argument can be used to close only the default blank format titled "Format1". Other formats must be closed separately with the Close method. You cannot use the Open method to reload "Format1.btw". The line btApp.Formats.Open(c:\Format1.btw true) will leave the existing Format1.btw file loaded (so the line will do nothing at all). The CloseOutFirstFormat argument cannot be left out if you are using C# or a scripting language such as VBScript.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = true

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Formats Collection Object

SEE ALSO:

Using the Format Object


Count Property (Formats)

Description

Returns the number of opened label formats.

Access

Read Only

Syntax

object.Count

The Count property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Count property returns the number of label formats currently opened in BarTender application.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Show total number of open formats

MessageBox.Show(btFormat.Formats.Count.ToString)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Show the number of open formats

MessageBox.Show(btFormat.Formats.Count.ToString());

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Formats Collection Object

SEE ALSO:

Using the Format Object


Job Object

Description

The Job object enables control of certain values, such as number of copies, when exporting a printer code template.

Properties

The following properties are supported:

Property | Description
FormatIDType | Sets and returns whether the Format ID field for a printer code template will be a Constant, Template Field, or whether the field type will be set by the printer driver.
FormatID | Sets and returns the Format ID value in a printer code template.
PrinterBatchCopiesType | Sets and returns whether the Batch Copies field for a printer code template will be a Constant or Template Field.
PrinterBatchCopies | Sets and returns the number of batch copies value in the printer code template.
PrinterCopiesType | Sets and returns whether the Identical copies field for a printer code template will be a Constant, Template Field, or Set by Print Dialog.
PrinterCopies | Sets and returns the number of copies value in the printer code template.
PrinterSerializedCopiesType | Sets and returns whether the Serialized Copies field for a printer code template will be a Constant, Template Field, or Set by Print Dialog.
PrinterSerializedCopies | Sets and returns the number of serialized copies value in the printer code template.


FormatIDType Property

Description

Sets and returns whether the format ID in a printer code template (the value of the FormatID property of the Job object) will be determined by the printer driver or will be set to be either a placeholder for variable data or a constant.

Access

Read/Write

Syntax

object.FormatIDType[=BtFormatIdValueType ]

The FormatIDType property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtFormatIdValueType | Required. Any of the BtFormatIdValueType constants. See below.

Settings

The BtFormatIdValueType argument can have any of the following settings:

Constant | Value | Description
btFormatIdConstant | 0 | The value of the FormatID property will be treated as a literal.
btFormatIdFromTemplateField | 1 | The value of the FormatID property will be treated as a placeholder that the print system will replace with an actual value.
btFormatIdSetByDriver | 2 | The printer driver will determine at print time the value of the FormatID property.
btFormatIdNotSupported | 3 | The printer driver is unable to make this template tag. FormatID property has no effect.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender job variable

Dim btJob As BarTender.Job

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Setting the job variable

btJob = btPrinterCodeTemplate.Job

'Setting the format ID type property

btJob.FormatIdType = BarTender.BtFormatIdValueType.btFormatIdConstant

'Setting the format ID property

btJob.FormatId = "StandardShippingLabel"

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender job variable

BarTender.Job btJob;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Setting the job variable

btJob = btPrinterCodeTemplate.Job;

//Setting the format ID type property

btJob.FormatIdType = BarTender.BtFormatIdValueType.btFormatIdConstant;

//Setting the format ID property

btJob.FormatId = "StandardShippingLabel";

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, "c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the message variable to the object

btMessages = obj as BarTender.Messages;

//Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Job Object


FormatID Property

Description

Sets and returns the value of the format ID in a printer code template. This is the ID of the printer's label format.

Access

Read/Write

Syntax

object.FormatID[=Printer'sLabelFormatID]

The FormatID property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Printer'sLabelFormatID | Required. A string.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender job variable

Dim btJob As BarTender.Job

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Setting the job variable

btJob = btPrinterCodeTemplate.Job

'Setting the format ID type property

btJob.FormatIdType = BarTender.BtFormatIdValueType.btFormatIdConstant

'Setting the format ID property

btJob.FormatId = "StandardShippingLabel"

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender job variable

BarTender.Job btJob;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Setting the job variable

btJob = btPrinterCodeTemplate.Job;

//Setting the format ID type property

btJob.FormatIdType = BarTender.BtFormatIdValueType.btFormatIdConstant;

//Setting the format ID property

btJob.FormatId = "StandardShippingLabel";

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, "c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the message variable to the object

btMessages = obj as BarTender.Messages;

//Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Job Object


PrinterBatchCopiesType Property

Description

[Not supported by all printer drivers] Sets and returns how the total number of labels (identical copies multiplied by serialized copies, if any) is determined in a printer code template. The value of the PrinterBatchCopies property of the Job object will be determined by the printer driver or will be set to be either a placeholder for variable data or a constant.

Access

Read/Write

Syntax

object.PrinterBatchCopiesType[=BtPrinterBatchCopiesValueType ]

The PrinterBatchCopiesType property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtPrinterBatchCopiesValueType | Required. Any of the BtPrinterBatchCopiesValueType constants. See below.

Settings

The BtPrinterBatchCopiesValueType argument can have any of the following settings:

Constant | Value | Description
btPrinterBatchCopiesConstant | 0 | The value of the PrinterBatchCopies property will be treated as a literal.
btPrinterBatchCopiesTemplateField | 1 | The value of the PrinterBatchCopies property will be treated as a placeholder that the print system will replace with an actual value. Required if either the identical copies setting or the serialized copies setting is derived from a template field.
btPrinterBatchCopiesFromPrintDialogCopies; | 2 | The value of the PrinterBatchCopies property will be determined by the value set in the Print Dialog.
btPrinterBatchCopiesNotSupported; | 3 | The value of the PrinterBatchCopies property will not be set.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender job variable

Dim btJob As BarTender.Job

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Setting the job variable

btJob = btPrinterCodeTemplate.Job

'Setting the printer batch copies type property

btJob.PrinterBatchCopiesType = BarTender.BtPrinterBatchCopiesValueType.btPrinterBatchCopiesConstant

'Setting the printer batch copies property value

btJob.PrinterBatchCopies = "3"

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender job variable

BarTender.Job btJob;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Setting the job variable

btJob = btPrinterCodeTemplate.Job;

//Setting the printer batch copies type property

btJob.PrinterBatchCopiesType = BarTender.BtPrinterBatchCopiesValueType.btPrinterBatchCopiesConstant;

//Setting the Printer Batch Copies property

btJob.PrinterBatchCopies = "3";

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, "c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the message variable to the object

btMessages = obj as BarTender.Messages;

//Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Job Object


PrinterBatchCopies Property

Description

Sets and returns the printer batch copies type in a printer code template.

Access

Read/Write

Syntax

object.PrinterBatchCopies[=PrinterBatchCopiesTypeValue]

The PrinterBatchCopies property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
PrinterBatchCopiesTypeValue | Required. A string.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender job variable

Dim btJob As BarTender.Job

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Setting the job variable

btJob = btPrinterCodeTemplate.Job

'Setting the printer batch copies type property

btJob.PrinterBatchCopiesType = BarTender.BtPrinterBatchCopiesValueType.btPrinterBatchCountConstant

'Setting the printer batch copies property value

btJob.PrinterBatchCopies = "3"

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender job variable

BarTender.Job btJob;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Setting the job variable

btJob = btPrinterCodeTemplate.Job;

//Setting the printer batch copies type property

btJob.PrinterBatchCopiesType = BarTender.BtPrinterBatchCopiesValueType.btPrinterBatchCountConstant;

//Setting the Printer Batch Copies property

btJob.PrinterBatchCopies = "3";

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, "c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the message variable to the object

btMessages = obj as BarTender.Messages;

//Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Job Object


PrinterCopiesType Property

Description

Sets and returns whether the printer copies value set in a printer code template (the value of the PrinterCopies property of the Job object) will be a placeholder for an integer inserted at print-time or a constant.

Access

Read/Write

Syntax

object.PrinterCopiesType[=BtPrinterCopiesValueType ]

The PrinterCopiesType property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtPrinterCopiesValueType | Required. Must be any BtPrinterCopiesValueType constants. See below.

Settings

The value argument can be any of these settings:

Constant | Value | Description
btPrinterCopiesConstant | 0 | The value of the PrinterCopies property will be treated as a literal.
btPrinterCopiesFromTemplateField | 1 | The value of the PrinterCopies property will be treated as a placeholder that the print system will replace with an actual value.
btPrinterCopiesNotSupported | 2 | The printer driver is unable to make this template tag.The PrinterCopies property has no effect.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender job variable

Dim btJob As BarTender.Job

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Setting the job variable

btJob = btPrinterCodeTemplate.Job

'Setting the printer copies type property

btJob.PrinterCopiesType = BarTender.BtPrinterCopiesValueType.btPrinterCopiesConstant

'Setting the printer copies property

btJob.PrinterCopies = "2"

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender job variable

BarTender.Job btJob;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Setting the job variable

btJob = btPrinterCodeTemplate.Job;

//Setting the printer copies type property

btJob.FormatIdType = btJob.PrinterCopiesType = BarTender.BtPrinterCopiesValueType.btPrinterCopiesConstant;

//Setting the printer copies property

btJob.PrinterCopies = "2";

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, "c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the message variable to the object

btMessages = obj as BarTender.Messages;

//Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Job


PrinterCopies Property

Description

Sets and returns the number of copies field in a printer code template.

Access

Read/Write

Syntax

object.PrinterCopies[=NumberOfCopies]

The PrinterCopies property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
NumberOfCopies | Required. A string or integer.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender job variable

Dim btJob As BarTender.Job

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Setting the job variable

btJob = btPrinterCodeTemplate.Job

'Setting the printer copies type property

btJob.PrinterCopiesType = BarTender.BtPrinterCopiesValueType.btPrinterCopiesConstant

'Setting the printer copies property

btJob.PrinterCopies = "2"

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender job variable

BarTender.Job btJob;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Setting the job variable

btJob = btPrinterCodeTemplate.Job;

//Setting the printer copies type property

btJob.FormatIdType = btJob.PrinterCopiesType = BarTender.BtPrinterCopiesValueType.btPrinterCopiesConstant;

//Setting the printer copies property

btJob.PrinterCopies = "2";

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, "c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the message variable to the object

btMessages = obj as BarTender.Messages;

//Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Job


PrinterSerializedCopiesType Property

Description

Sets and returns how the number of serialized copies is determined in a printer code template (the value of the PrinterSerializedCopies property of the Job object) .

Access

Read/Write

Syntax

object.PrinterSerializedCopiesType[=BtPrinterSerializedCopiesValueType ]

The PrinterSerializedCopiesType property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtPrinterSerializedCopiesValueType | Required. Any of the BtPrinterSerializedCopiesValueType constants. See below.

Settings

The BtPrinterSerializedCopiesValueType argument can have any of the following settings:

Constant | Value | Description
btPrinterSerializedCopiesConstant | 0 | The value of the PrinterSerializedCopies property will be treated as a literal.
btPrinterSerializedCopiesFromTemplateField | 1 | The value of the PrinterSerializedCopies property will be treated as a placeholder that the print system will replace with an actual value.
btPrinterSerializedCopiesFromPrintDialogCopies; | 2 | The print dialog copies setting will be used to determine the value of the PrinterSerializedCopies property.
btPrinterSerializedCopiesNotSupported; | 3 | The value of the PrinterSerializedCopies property indicates this functionality will not be used.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender job variable

Dim btJob As BarTender.Job

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Setting the job variable

btJob = btPrinterCodeTemplate.Job

'Setting the serialized copies value type property

btJob.PrinterSerializedCopiesType = BarTender.BtPrinterCopiesValueType.btPrinterSerializedCopiesFromPrintDialogCopies

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender job variable

BarTender.Job btJob;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Setting the job variable

btJob = btPrinterCodeTemplate.Job;

//Setting the printer serialized copies type property

btJob.PrinterSerializedCopiesType = BarTender.BtPrinterSerializedCopiesValueType.btPrinterSerializedCopiesFromPrintDialogCopies;

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, "c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the message variable to the object

btMessages = obj as BarTender.Messages;

//Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Job Object


PrinterSerializedCopies Property

Description

Sets and returns the value of the PrinterSerializedCopies setting in a printer code template.

Access

Read/Write

Syntax

object.PrinterSerializedCopies[=PrinterSerializedCopiesTypeValue]

The PrinterSerializedCopies property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
PrinterSerializedCopiesTypeValue | Required. A string.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender job variable

Dim btJob As BarTender.Job

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Setting the job variable

btJob = btPrinterCodeTemplate.Job

'Setting the printer serialized type property

btJob.PrinterSerializedCopiesType = BarTender.BtPrinterSerializedCopiesType.btPrinterSerializedCopiesConstant

'setting the PrinterSerializedCopies property

btJob.PrinterSerializedCopies = "3"

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender job variable

BarTender.Job btJob;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Setting the job variable

btJob = btPrinterCodeTemplate.Job;

//Setting the PrinterSerializedCopies type property

btJob.PrinterSerializedCopiesType = BarTender.BtPrinterSerializedCopiesType.btPrinterSerializedCopiesConstant;

//Setting the format ID property

btJob.PrinterSerializedCopies = "3";

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, "c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the message variable to the object

btMessages = obj as BarTender.Messages;

//Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Job Object


LicenseServer Object

Description

The LicenseServer object represents the settings that enable the BarTender to communicate with the Seagull License Server.

Properties

The following properties are supported.

Property | Description
Address | Sets and returns the address of the preferred Seagull License Server.
AlternateAddress | Sets and returns the address of the Seagull License Server that should be used if the preferred server is not available.
AlternatePort | Sets and returns the port used to communicate with the alternate Seagull License Server.
AlternateTimeout | Sets and returns the maximum length of time that BarTender will keep trying to communicate with the alternate Seagull License Server before giving up.
IsConnected | Returns status of BarTender’s connection to the Seagull License Server. True means connected. False means not connected.
Port | Sets and returns the port used to communicate with the Seagull License Server.
Timeout | Sets and returns the maximum length of time that BarTender will keep trying to communicate with the Seagull License Server before giving up.

Methods

The following methods are supported.

Method | Description
Connect | Connects BarTender to its Seagull License Server and returns true, meaning success, or False, meaning failure.


Connect Method

Description

Connects BarTender to its Seagull License Server and returns true, meaning success, or false, meaning failure.

Syntax

object.Connect

The Connect method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Checking to see if BarTender is connected to License Server

If btApp.LicenseServer.Connect = True Then
MessageBox.Show("Connected")
Else
MessageBox.Show("Not Connected")
End If

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Checking to see if BarTender is connected to License Server

if (btApp.LicenseServer.Connect()
 == true)
{
MessageBox.Show("Connected");
}
else
{
MessageBox.Show("Not Connected");
}

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

License Server Object


Address Property

Description

Sets and returns the address of the preferred Seagull License Server. See also the AlternateAddress Property.

Access

Read/Write

Syntax

object.Address [=Address]

The Address property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Address | Required. The address of the computer running the license server. See Remarks section for details.

Remarks

The Address property sets and returns the address of the computer that is running the preferred Seagull License Server. (If the preferred server is not available, BarTender will use the server specified with the AlternateAddress Property.) The address can be a server name (e.g., MyServer), a domain name (e.g., Shipping.MyCompany.com), an IP address (e.g., 10.1.1.68), or the asterisk, "*"). Setting the address to "*" will turn on AutoDetect. Getting a "*" indicates that AutoDetect is turned on.

Note: AutoDetect will not find a Seagull License Server that is behind a network router. So you may want to set the AlternateAddress Property in addition to the Address Property.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the license server address property

btApp.LicenseServer.Address = "MyPC"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the license server address property

btApp.LicenseServer.Address = "MyPC";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

LicenseServer Object


AlternateAddress Property

Description

Sets and returns the address of the Seagull License Server to be used if the server specified with the Address Property is not available.

Access

Read/Write

Syntax

object.AlternateAddress [=Address]

The AlternateAddress property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Address | Required. The address of the computer running the alternate license server. See Remarks section for details.

Remarks

The AlternateAddress property sets and returns the address of the the Seagull License Server that should be used if the preferred server (set and returned with the Address Property) is not available. The address can be a server name (e.g., MyServer), a domain name (e.g., Shipping.MyCompany.com), an IP address (e.g., 10.1.1.68), or the asterisk, "*"). Setting the address to "*" will turn on AutoDetect. Getting a "*" indicates that AutoDetect is turned on.

Note: AutoDetect will not find a Seagull License Server that is behind a network router.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the license server address property

btApp.LicenseServer.Address = "MyPC"

'Setting the alternate license server address property

btApp.LicenseServer.AlternateAddress = "MyBackupPC"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the license server address property

btApp.LicenseServer.Address = "MyPC";

//Setting the alternate license server address property

btApp.LicenseServer.AlternateAddress = "MyBackupPC";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

LicenseServer Object


AlternatePort Property

Description

Sets and returns the port used to communicate with an alternate Seagull License Server when the preferred server is not available.

Access

Read/Write

Syntax

object.AlternatePort [=value]

The AlternatePort property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
value | Required. Any integer from 1024 to 65535.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the license server port property

btApp.LicenseServer.Port = 5160

'Setting the alternate license server port property

btApp.LicenseServer.AlternatePort = 6000

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the license server port property

btApp.LicenseServer.Port = 5160;

//Setting the alternate license server port property

btApp.LicenseServer.AlternatePort = 6000;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

LicenseServer Object


AlternateTimeout Property

Description

Sets and returns the maximum length of time that BarTender will keep trying to communicate with the Seagull License Server before giving up. This property is only used when an alternate Seagull License Server is being used because the preferred server is unavailable.

Access

Read/Write

Syntax

object.AlternateTimeout [=value]

The AlternateTimeout property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
value | Required. The timeout value in seconds.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the timeout property

btApp.LicenseServer.Timeout = 15

'Setting the alternate timeout property

btApp.LicenseServer.AlternateTimeout = 30

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the timeout property

btApp.LicenseServer.Timeout = 15;

//Setting the alternate timeout property

btApp.LicenseServer.AlternateTimeout = 30;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

LicenseServer Object


IsConnected Property

Description

Returns status of BarTender’s connection to the Seagull License Server. True means connected. False means not connected.

Access

Read

Syntax

object.IsConnected

The IsConnected property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The following Visual Basic example shows how to use the IsConnected property.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Checking to see if BarTender is connected to License Server

If btApp.LicenseServer.IsConnected = True Then
MessageBox.Show("Connected")
Else
MessageBox.Show("Not Connected")
End If

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Checking to see if BarTender is connected to License Server

if (btApp.LicenseServer.IsConnected
 == true)
{
MessageBox.Show("Connected");
}
else
{
MessageBox.Show("Not Connected");
}

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

License Server Object


Port Property

Description

Sets and returns the port used to communicate with the Seagull License Server.

Access

Read/Write

Syntax

object.Port[=Value]

The Port property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Value | Required. Any integer from 1024 to 65535.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the license server port property

btApp.LicenseServer.Port = 5160

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the license server port property

btApp.LicenseServer.Port = 5160;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

LicenseServer


Timeout Property

Description

Sets and returns the maximum length of time that BarTender will keep trying to communicate with the Seagull License Server before giving up.

Access

Read/Write

Syntax

object.Timeout[=Seconds]

The Timeout property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Seconds | Required. The timeout value in seconds.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the timeout property

btApp.LicenseServer.Timeout = 15

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the timeout property

btApp.LicenseServer.Timeout = 15;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

LicenseServer


MediaHandling Object

Description

The MediaHandling object controls how BarTender media handling actions such as cut and pause. This object is the child of a PageSetup object.

Properties

The following properties are supported:

Property | Description
Action | Sets and returns what media handling action will be taken.
DataItemName | Sets and returns the name of the data item used as an occurrence.
DataItemType | Sets and returns what kind of data item will be used as an occurrence.
IgnoreCase | Sets and returns whether data value ignores case value or not.
NumberLabels | Sets and returns the number of labels printed if number of labels is the trigger.
Occurrence | Sets and returns the trigger for the media handling action.


Action Property

Description

Sets/returns the Action property value. Used with Media Handling to determine what action(s) to take when an event is triggered.

Access

Read/Write

Syntax

object.Action[=btMediaHandlingActions]

The Action property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtMediaHandlingActions | Required. Any of the BtMediaHandlingActions constants. See below.

Settings

The BtMediaHandlingActions argument can have any of the following settings:

Constant | Value | Description
btMHDriverSettings | 0 | Use the driver settings.
btMHPageBreak | 1 | Causes a page break action.
btMHPause | 2 | Pause.
btMHWaitForLabelTakenSensor | 3 | Wait for label to be taken.
btMHCut | 4 | Cut
btMHCutAndPause | 5 | Cut, then pause

Remarks

The Media Handling action can be one event (Cut) or a sequence of events (Cut and Pause). If set to the default value of Driver Settings BarTender uses the action specified by the printer driver.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender media handling variable

Dim btMediaHandling As BarTender.MediaHandling

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the media handling variable

btMediaHandling = btFormat.PageSetup.MediaHandling

'Setting the action to cut

btMediaHandling.Action=BarTender.BtMediaHandlingAction.btMHCut

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Declaring the media handling variable

btMediaHandling=BarTender.MediaHandling;

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the media handling variable

btMediaHandling = btFormat.PageSetup.MediaHandling;

//Setting the action to cut

btMediaHandling.Action=BarTender.BtMediaHandlingAction.btMHCut;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

MediaHandling


DataItemName Property

Description

Sets/returns the value of the DataItemName. Used with Media Handling to trigger actions associated with database values.

Access

Read/Write

Syntax

object.DataItemName[=DataItemNameValue]

The DataItemName property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
DataItemNameValue | String. The name of the data item to be used.

Remarks

Sets/returns the name used to reference the data item by which Media Handling action will be triggered. The DataItemType should be set to specify the kind of data to be evaluated.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender media handling variable

Dim btMediaHandling As BarTender.MediaHandling

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the media handling variable

btMediaHandling = btFormat.PageSetup.MediaHandling

'Setting the data item name value

btMediaHandling.DataItemName="dbTest.Address"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender media handling variable

BarTender.MediaHandling btMediaHandling;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the media handling variable

btMediaHandling = btFormat.PageSetup.MediaHandling;

//Setting the data item name value

btMediaHandling.DataItemName="dbTest.Address";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

MediaHandling


DataItemType Property

Description

Sets/returns the type of data item to be used. Used with Media Handling to trigger actions associated with database values.

Access

Read/Write

Syntax

object.DataItemType[=BtMediaHandlingDataItemType]

The DataItemType property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtMediaHandlingDataItemType | Required. Any of the BtMediaHandlingDataItemType constants. See below.

Settings

The BtMediaHandlingDataItemType argument can have any of the following settings:

Constant | Value | Description
btMHDatabaseField | 0 | Type is set to a database field value
btMHNamedSubstring | 1 | Type is set to a named substring value
btMHNamedObject | 2 | Type is set to a named object value

Remarks

Sets/returns the type of data to be used for Media Handling in the label format. Use DataItemName to specify the name to be evaluated.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender media handling variable

Dim btMediaHandling As BarTender.MediaHandling

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the media handling variable

btMediaHandling = btFormat.PageSetup.MediaHandling

'Setting the data item type value

btMediaHandling.DataItemType=BarTender.BtMediaHandlingDataItemType.btMHDatabaseField

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender media handling variable

BarTender.MediaHandling btMediaHandling;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the media handling variable

btMediaHandling = btFormat.PageSetup.MediaHandling;

//Setting the data item type value

btMediaHandling.Occurrence=BarTender.BtMediaHandlingDataItemType.btMHDatabaseField;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

MediaHandling


IgnoreCase Property

Description

Sets/returns whether or not a DataItemType value will treat any change from upper to lower case, or vice versa, as a data change. If set to true, any case differences in the data item text will be ignored.

Access

Read/Write

Syntax

object.IgnoreCase[=true|false]

The IgnoreCase property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Boolean. If true, the case of the data item will be ignored.

Remarks

Sets/returns whether case is ignored when comparing data item values.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender media handling variable

Dim btMediaHandling As BarTender.MediaHandling

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the media handling variable

btMediaHandling = btFormat.PageSetup.MediaHandling

'Setting the ignore case value

btMediaHandling.IgnoreCase=true

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender media handling variable

BarTender.MediaHandling btMediaHandling;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the media handling variable

btMediaHandling = btFormat.PageSetup.MediaHandling;

//Setting the ignore case value

btMediaHandling.IgnoreCase=true;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

MediaHandling


NumberLabels Property

Description

Sets/returns the number of labels that can act as a trigger. Used with Media Handling where Number of Labels is the determining quantity for an action.

Access

Read/Write

Syntax

object.NumberLabels[=numberLabelsValue]

The NumberLabels property has the following parts:

Part | Description
object | Required. Any of the BtMediaHandlingOccurrence constants. See below.
numberLabelsValue | Integer. The number of labels before an action is triggered.

Remarks

Sets/returns the number of labels to be used as the Media Handling trigger. This is used in conjunction with the Media Handling Occurrence AfterNumberOfLabels.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender media handling variable

Dim btMediaHandling As BarTender.MediaHandling

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btMediaHandling = btFormat.PageSetup.MediaHandling

'Setting the number of labels

btMediaHandling.NumberLabels=6

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender media handling variable

BarTender.MediaHandling btMediaHandling;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the media handling variable

btMediaHandling = btFormat.PageSetup.MediaHandling;

//Setting the number of labels

btMediaHandling.NumberLabels=6;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

MediaHandling


Occurrence Property

Description

Sets/returns the Occurrence setting. Used with Media Handling to determine when actions should be triggered.

Access

Read/Write

Syntax

object.Occurrence[=BtMediaHandlingOccurrence]

The Occurrence property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtMediaHandlingOccurrence | Required. Any of the BtMediaHandlingOccurrence constants. See below.

Settings

The BtMediaHandlingOccurrence argument can have any of the following settings:

Constant | Value | Description
btMHAtEndOfPrintJob | 0 | Action will occur at end of print job
btMHAfterEveryPage | 1 | Action will occur after every page
btMHAfterEveryRecord | 2 | Action will occur after each record
btMHAfterIdenticalCopies | 3 | Action will occur after all copies of an identical label have printed
btMHAfterDataChange | 4 | Action will occur after a specified database record has changed value. See DataItemType and DataItemName.
btMHAfterNumberOfLabels | 5 | Action will occur after a specified number of labels have printed.

Remarks

The Occurrence property determines when a Media Handling action will be performed. Some selections, such as After Number of Labels, will require additional information (in this case, the desired number of labels to print before performing the action.)

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender media handling variable

Dim btMediaHandling As BarTender.MediaHandling

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the media handling variable

btMediaHandling = btFormat.PageSetup.MediaHandling

'Setting the occurrence value

btMediaHandling.Occurrence=BarTender.BtMediaHandlingOccurrence.btMHAtEndOfPrintJob

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender media handling variable

BarTender.MediaHandling btMediaHandling;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the media handling variable

btMediaHandling = btFormat.PageSetup.MediaHandling;

//Setting the label height in current units

btMediaHandling.Occurrence=BarTender.BtMediaHandlingOccurrence.btMHAtEndOfPrintJob;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

MediaHandling


Message Object

Description

The Message object represents an informational, warning, or error message.

Properties

The following properties are supported:

Property | Description
Message | Returns the contents of the message.
Number | Returns the unique ID number of the message.
Severity | Returns whether the message is an error, a warning, or merely informational.
Type | Returns the category of the error, e.g., printer or database.
Verification | Returns a reference to a Verification object.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender messages variable to hold all messages

Dim btMessages As BarTender.Messages

'Declaring a variable for holding message text

Dim ExportSuccess As Boolean

'Declaring a success variable

Dim btMessageText As String

'Declaring loop counter

Dim i As Integer

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Exporting the printer code template

ExportSuccess = btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Checking to see if there is an error message

If ExportSuccess = False Then

'Looping through the messages

For i = 1 To btMessages.Count

'Populating error messages into a string

btMessageText = btMessageText & btMessages.GetMessage(i).Severity & vbCrLf & btMessages.GetMessage(i).Number _
& " " & btMessages.GetMessage(i).Message

Next i

'Display the problem with exporting the printer code

MessageBox.Show("Export Failed. Errors and Warnings: " & btMessageText)

Else

'Looping through the messages

For Each btMessage In btMessages

'Populating warning messages into a string

btMessageText = btMessageText & vbCrLf & btMessage.Severity & " " & btMessage.Number & " " & btMessage.Message

Next

'Display the problem with exporting the printer code

MessageBox.Show("Export Failed. Errors and Warnings: " & btMessageText)

End If

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring a variable for holding message text

string btMessageText = "";

//Declaring a sucess variable

bool ExportSuccess;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Exporting the printer code template

ExportSuccess = btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate,
"c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn",
ref obj);

//Setting the message variable to the object

btMessages = obj as BarTender.Messages;

//Checking to see if there is an error message

if (ExportSuccess == false)

{

//Looping through the messages

for (int i = 1; i <= btMessages.Count; i++)

{

//Populating error messages into a string

        btMessageText += "\r\n" +
btMessages.GetMessage(i).Severity + "\r\n" + btMessages.GetMessage(i).Number+
"\r\n" + btMessages.GetMessage(i).Message;

}

//Display the problem with exporting the printer code

MessageBox.Show("Export failed. Errors and Warnings: " + btMessageText);

}

else

{

//Looping through the messages

foreach (BarTender.Message btMessage in btMessages)

{

//Populating warning messages into a string

btMessageText += "\r\n" + btMessage.Severity + "\r\n" + btMessage.Number +
"\r\n" + btMessage.Message;

}

//Display the problem with exporting the printer code

MessageBox.Show("Export succeeded. Warnings: " + btMessageText);

}

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);


Message Property of the Message Object

Description

The Message property of the Message object returns a brief description of the contents of a message.

Access

Read Only

Syntax

object.Message

The Message property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Problem property of the Verification object (which is a property of the Message object) has a more detailed description of the problem.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate,
"c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the messages variable to the object

btMessages = obj as BarTender.Messages;

//Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Message


Number Property

Description

Returns the unique ID number of a message.

Access

Read Only

Syntax

object.Number

The Number property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Number property returns the unique ID of the message.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Getting the ID of the first message in the collection

MessageBox.Show(btMessages.GetMessage(1).Number.ToString)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate,
"c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the messages variable to the object

btMessages = obj as BarTender.Messages;

//Getting the ID of the first message in the collection

MessageBox.Show(btMessages.GetMessage(1).Number.ToString());

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Message


Severity Property

Description

Returns the severity of a message.

Access

Read Only

Syntax

object.Severity

The Severity property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Settings

The property takes as a value any of the BtMsgSeverity constants:

Constant | Value | Description
btMsgSeverityInformation | 0 | An informational message. The template will be exported.
btMsgSeverityWarning | 1 | A warning. The template will be exported.
btMsgSeverityError | 2 | An error. The template will not be exported.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Showing the severity of error

MessageBox.Show(btMessages.GetMessage(1).Severity.ToString)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate,
"c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the messages variable to the object

btMessages = obj as BarTender.Messages;

//Showing the severity of error

MessageBox.Show(btMessages.GetMessage(1).Severity.ToString());

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Message Object


Type Property (Message)

Description

Returns the category of the error, e.g., printer or database.

Access

Read Only

Syntax

object.Type

The Type property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Settings

The property can have any of the BtMsgType constants:

Constant | Value | Description
btMsgTypeMiscellaneous | 0 | The issue concerns something that does not fit in any of the other categories.
btMsgTypeVBScripting | 1 | The issue concerns a VBscript associated with the label format.
btMsgTypePrinter | 2 | The issue concerns the printer.
btMsgTypeDatabase | 3 | The issue concerns database access.
btMsgTypeFile | 4 | The issue concerns a file.
btMsgTypeCommandLine | 5 | The issue concerns the BarTender command line.
btMsgTypeNetworkTrace | 6 | The issue concerns the network connections of the computer running BarTender.
btMsgTypeLicensing | 7 | The issue concerns the BarTender or printer license.
btMsgTypeEmail | 8 | The issue concerns BarTender's e-mail messaging system.
btMsgTypeService | 9 | The issue concerns running BarTender as a service.
btMsgTypeVerification | 10 | The issue concerns some aspect of the label design during an attempt to export a printer code template.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Ignore a certain category of messages. Show the others.

For i = 0 to btMessage.Count
If btMessages(i).Type = btMsgTypeDatabase Then
'Do nothing
Else
btMessageText = btMessageText & vbCrLf &

btMessages.Item(i).Severity & " " & btMessages.Item(i).Message
End If
Next i
MsgBox "Export failed. Errors and Warnings: " & btMessageText

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate,
"c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the messages variable to the object

btMessages = obj as BarTender.Messages;

//Ignore a certain category of messages. Show the others.

for (i = 0; i <= btMessage.Count; i++)

 {
if (btMessages(i).Type == btMsgTypeDatabase)
//Do nothing
else
btMessageText = btMessageText &
 vbCrLf &

btMessages.Item(i).Severity & " " & btMessages.Item(i).Message;
}
MessageBox.Show("Export failed. Errors and Warnings: " + btMessageText);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Message


Verification Property

Description

Returns a reference to a Verification object.

Access

Read Only

Syntax

object.Verification

The Verification property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Verification property returns a reference to the Message's Verification object, which controls details of the message and whether AutoFix should be used.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender verification variable

Dim btVerification As BarTender.Verification

'Declaring a BarTender messages variable to hold all messages

Dim btMessages As BarTender.Messages

'Declaring a BarTender message variable to hold individual messages

Dim btMessage As BarTender.Message

'Declaring a variable for holding message text

Dim btMessageText As String

'Declaring a success variable

Dim ExportSuccess As Boolean

'Declaring loop counter

Dim i As Integer

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Exporting the printer code template

ExportSuccess = btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Checking to see if there is an error message

If ExportSuccess = False Then

'Looping through the messages

For i = 1 To btMessages.Count

'Getting the error message

btVerification = btMessages.GetMessage(1).Verification

'Populating error messages into a string

btMessageText = btMessageText & btVerification.Problem & vbCrLf & btVerification.Fields & _
" " & btVerification.AutoFix & vbCrLf & btVerification.Result

Next i

'Display the problem with exporting the printer code

MessageBox.Show("Export Failed. Errors and Warnings: " & btMessageText)

Else

'Looping through the messages

For Each btMessage In btMessages

'Getting the error message

btVerification = btMessages.GetMessage(1).Verification

'Populating warning messages into a string

btMessageText = btMessageText & btVerification.Problem & vbCrLf & btVerification.Fields & _
" " & btVerification.AutoFix & vbCrLf & btVerification.Result

Next

'Display the problem with exporting the printer code

MessageBox.Show("Export Failed. Errors and Warnings: " & btMessageText)

End If

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender verification variable

BarTender.Verification btVerification;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring a variable for holding message text

string btMessageText = "";

//Declaring a success variable

bool ExportSuccess;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Exporting the printer code template

ExportSuccess = btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate,
"c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn",
ref obj);

//Setting the message variable to the object

btMessages = obj as BarTender.Messages;

//Checking to see if there is an error message

if (ExportSuccess == false)

{

//Looping through the messages

for (int i = 1; i <= btMessages.Count; i++)

{

//Getting the error message

btVerification = btMessages.GetMessage(1).Verification;

//Populating error messages into a string

btMessageText = btMessageText + btVerification.Problem + "\r\n" + btVerification.Fields +
" " + btVerification.AutoFix + "\r\n" + btVerification.Result;

}

//Display the problem with exporting the printer code

MessageBox.Show("Export failed. Errors and Warnings: " + btMessageText);

}

else

{

//Looping through the messages

foreach (BarTender.Message btMessage in btMessages)

{

//Getting the error message

btVerification = btMessages.GetMessage(1).Verification;

//Populating error messages into a string

btMessageText = btMessageText + btVerification.Problem + "\r\n" + btVerification.Fields +
" " + btVerification.AutoFix + "\r\n" + btVerification.Result;

}

//Display the problem with exporting the printer code

MessageBox.Show("Export succeeded. Warnings: " + btMessageText);

}

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Message


Messages Collection Object

Description

The Messages Collection object contains all the message objects for the current format. A message object is created when the Export method of the PrinterCodeTemplate object is used.

Properties

The following properties are supported:

Property | Description
Count | Returns the number of messages.

Methods

The following methods are supported:

Method | Description
GetMessage | Returns a reference to a specified Message object.
Item | Returns a reference to a specified Message object.

SEE ALSO:

Message Object


GetMessage Method

Description

Returns a reference to a specified message object.

Syntax

object.GetMessage (Index)

The GetMessage method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Index | Required. Index of the message object. Alternatively, you can use the messages Number property as a string.

Remarks

Use the GetMessage method to access a specific message in the messages collection.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message)

'Alternatively, you could use the Number property of the message:

'MessageBox.Show(btMessages.GetMessage("3367").Message)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate,
"c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the messages variable to the object

btMessages = obj as BarTender.Messages;

//Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message);

//Alternatively, use the message's ID number:

//MessageBox.Show(btMessages.GetMessage("3367").Message);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Messages Collection Object


Item Method (Messages)

Description

Returns a reference to a specified Message object.

Note: This method has the same functionality as the GetMessage method.

Syntax

object.Item (Index)

The Item method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Index | Required. Index of the messages object.

Remarks

Use the Item method to access a specific message in the messages collection.

Applies To

Messages Collection Object


Count Property (Messages)

Description

Returns the number of messages.

Access

Read Only

Syntax

object.Count

The Count property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Count property returns the number of messages created by an attempt to export a printer code template.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Show the number of messages

MessageBox.Show(btMessages.Count.ToString)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate,
"c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the messages variable to the object

btMessages = obj as BarTender.Messages;

//Show the number of messages

MessageBox.Show(btMessages.Count.ToString());

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Messages Collection Object


GetAll Method

Description

Returns a string that contains the name and value of all substrings separated by a delimiter.

Syntax

object.GetAll (NameValueDelimiter, RecordDelimiter)

The GetAll method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
NameValueDelimiter | Required. The delimiter to use to separate the name and value.
RecordDelimiter | Required. The delimiter to use to separate multiple substring name/value pairs.

Remarks

Use the GetAll method to return a string that contains the name and value of all substrings separated by a delimiter. This function is more efficient then using the GetNamedSubStringValue method, because it only makes one call to retrieve the information as opposed to multiple calls to GetNamedSubStringValue to get the same information.

GetAll will return a string consisting of name/value pairs. The NameValueDelimiter will separate the name and value of each substring. Multiple substring name/value pairs will be separated by the RecordDelimiter.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Getting all the named substrings

MessageBox.Show(btFormat.NamedSubStrings.GetAll(",", ":"))

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Getting all the named substrings

MessageBox.Show(btFormat.NamedSubStrings.GetAll("'", ":"));

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

NamedSubStrings Collection

SEE ALSO:

Changing Text and Bar Code Data On The Label


GetSubString Method

Description

Returns a reference to a specified SubString object.

Syntax

object.GetSubString (Index)

The GetSubString method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Index | Required. The index of SubString object. Alternatively, use the substring's Name property as a string.

Remarks

Use the GetSubString method to access a specific SubString object that is setup on BarTender label format. Index can be either an integer value or a string specifying the substring name. The order of substrings in the collection is not guaranteed to be in the order of substrings in the object(s). Therefore we recommend referencing a SubString by its name, rather by an integer index.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender substring variable

Dim btSubString As BarTender.SubString

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the substring

btSubString = btFormat.SubStrings.GetSubString(1)

'Alternatively, use the substring's Name property if it is known

'btSubString = btFormat.SubStrings.GetSubString("bikes")

'Showing the substring's name

MessageBox.Show(btSubString.Name)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender substring variable

BarTender.SubString btSubString;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the substring

btSubString = btFormat.SubStrings.GetSubString(1);

//Alternatively, use the substring's name if it is known

//btSubString = btFormat.SubStrings.GetSubString("bikes");

//Showing the substring's name

MessageBox.Show(btSubString.Name);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

NamedSubStrings Collection Object

SEE ALSO:

Changing Text and Bar Code Data On The Label


Item Method (Named SubStrings)

Description

Returns a reference to a specified SubString object.

Note: This method has the same functionality as the GetSubString method.

Syntax

object.Item (Index)

The Item method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Index | Required. Index of the SubString object to reference. Can be either an integer or string index.

Remarks

Use the Item method to access a specific SubString object that is setup on BarTender label format. Index can be either an integer value or a string index specifying the substring name. In VB.NET Item is the default method for the NamedSubStrings collection, therefore the Item method does not have to be specified in order to get a reference to a given SubString object. The SubString object can be referenced directly using the NamedSubStrings collection. The order of SubStrings in the collection is not guaranteed to be in the order of substrings in the object(s). Therefore it is preferred to reference a SubString by its name, rather by an integer index.

Applies To

NamedSubStrings Collection Object

SEE ALSO:

Changing Text and Bar Code Data On The Label


SetAll Method

Description

Sets all substrings using a string that contains the name and value separated by a delimiter.

Syntax

object.SetAll (String, Delimiter)

The SetAll method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
String | Required. A string in quotation marks or a String variable.
Delimiter | Required. The delimiter to use to separate the name and value of each name/value record. Only the first character will be used as the delimiter. All remaining characters in the string will be ignored.

Remarks

Sets all substrings using a string that contains the name and value separated by a delimiter. This function is more efficient than using the SetNamedSubStringValue method, because it only makes one call to set the substring value as opposed to multiple calls to SetNamedSubStringValue.

The following example sets substring values for Name, Address, and Zip. To do this we need to format the name and value of each substring into a string delimited by a line feed character.

Name <LineFeed>
Jared Stevens <LineFeed>
Address <LineFeed>
123 Street <LineFeed>
Zip <LineFeed>
98296

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a string variable

Dim btNamedSubString As String

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the name

btNamedSubString = "Name" & vbLf & "Jared Stevens" & vbLf

'Setting the address

btNamedSubString = btNamedSubString & "Address" & vbLf & "123 Street" & vbLf

'Setting the Zip code

btNamedSubString = btNamedSubString & "Zip" & vbLf & "98296"

'Setting all the named subsstrings

btFormat.NamedSubStrings.SetAll(btNamedSubString, vbLf)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a string variable

string btNamedSubString;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the name

btNamedSubString = "Name" + "\r\n" + "Jared Stevens" + "\r\n";

//Setting the address

btNamedSubString += "Address" + "\r\n" + "123 Street" + "\r\n";

//Setting the Zip code

btNamedSubString += "Zip" + "\r\n" + "98296";

//Setting all the named substrings

btFormat.NamedSubStrings.SetAll(btNamedSubString, "\r\n");

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

NamedSubStrings Collection Object

SEE ALSO:

Changing Text and Bar Code Data On The Label


Count Property (Substrings)

Count Property (NamedSubstrings)

Description

Returns the number of named substrings defined on the label format.

Access

Read Only

Syntax

object.Count

The Count property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Count property returns the number of named substrings defined on the label format.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Show total named substrings

MessageBox.Show(btFormat.NamedSubStrings.Count.ToString)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Show the number of named substrings

MessageBox.Show(btFormat.NamedSubStrings.Count.ToString());

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

NamedSubStrings Collection Object

SEE ALSO:

Changing Text and Bar Code Data On The Label


ODBC Object

Description

The ODBC object represents an ODBC Data Source database.

Properties

The following properties are supported:

Property | Description
Password | Sets the ODBC database password.
SQLStatement | Sets and returns the custom SQL statement.
UserId | Sets and returns the ODBC database user Id.
Where Property | Sets and returns the Where clause. (Obsolete as of version 6.0. See the SQLStatement property).

SEE ALSO:

Automating Database Printing.

Databases Collection

Database Object

OLEDB Object

TextFile Object

SAPIDoc Object


Password Property (ODBC)

Description

Sets the password for the ODBC database.

Access

Write Only

Syntax

object.Password[=Password]

The Password property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Password | Optional in VB, otherwise required. The password to the ODBC database.

Remarks

The Password property sets the password for the ODBC database. The Password property will always return an empty string if read.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Setting the user ID

btDb.ODBC.UserId = "Administrator"

'Setting the password

btDb.ODBC.Password = "12345"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Setting the user ID

btDb.ODBC.UserId = "Administrator";

//Setting the password

btDb.ODBC.Password = "12345";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

ODBC

SEE ALSO:

Database Object

Databases Collection Object

Automating Database Printing


SQLStatement Property (ODBC)

Description

Sets and returns the custom SQL statement.

Access

Read/Write

Syntax

object.SQLStatement[=Statement]

The SQLStatement property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Statement | Optional in VB, otherwise required. The SQL statement.

Remarks

The SQLStatement property sets and returns a custom SQL statement for record selection within an ODBC database. The SQL statement will be applied at data browsing or print-time to perform record filtering. Setting the SQLStatement property will imply the use of a custom SQL statement and the options found in the Tables, Query, Join, and Sort tabs of an ODBC database will be ignored.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Setting the SQL statement

btDb.ODBC.SQLStatement = "SELECT * FROM 'Customers' WHERE 'Name'='Frank Wild'"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Setting the SQL statement

btDb.ODBC.SQLStatement = "SELECT * FROM 'Customers' WHERE 'Name'='Frank Wild'";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

ODBC

SEE ALSO:

Database Object

Databases Collection Object

Automating Database Printing


UserId Property (ODBC)

Description

Sets and returns the ODBC database user identification.

Access

Read/Write

Syntax

object.UserId[=ID]

The UserId property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
ID | Optional in VB, otherwise required.. String. The user name for access to the ODBC database.

Remarks

The UserId property sets and returns the user id for the selected ODBC database. If a user ID does not exist, then an empty string will be returned.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Setting the user ID

btDb.ODBC.UserId = "Administrator"

'Setting the password

btDb.ODBC.Password = "12345"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Setting the user ID

btDb.ODBC.UserId = "Administrator";

//Setting the password

btDb.ODBC.Password = "12345";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

ODBC

SEE ALSO:

Database Object

Databases Collection Object

Automating Database Printing.


Where Property

Where Property (Obsolete)

Description

Sets and returns the "Where" clause.

Note: This property is obsolete as of version 6.0. It is supported for backward compatibility only. Use the SQLStatement property.

Access

Read/Write

Syntax

object.Where[=Clause]

The Where property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Clause | Required. The SQL where clause.

Remarks

Note: The Where property is obsolete, and is supported only for backward compatibility. Use the SQLStatement property instead.

The Where property sets and returns the where clause for record selection within an ODBC database. The where clause will be applied at data browsing or print time to perform record filtering. If the ODBC database is not setup to use a Custom SQL Statement, then setting the Where property will create one. The custom SQL statement will be parsed for the first occurrence of the WHERE string in your custom SQL statement, and will replace all remaining text with the contents of the Where property’s value. If a WHERE clause is not found in your custom SQL statement, then the Where property value will be placed at the end of your SQL statement. If you are using a custom SQL statement, you should not set the Where property because it will interfere with your custom SQL statement. It is recommended that you use only the SQLStatement property unless the Where property cannot be avoided.

Applies To

ODBC

SEE ALSO:

SQLStatement Property

Database Object

Databases Collection Object

TextFile Object

Automating Database Printing.


OLEDB Object

Description

The OLEDB object represents an OLE DB Data Source.

Properties

The following properties are supported:

Property | Description
Password | Sets the OLE DB password.
SQLStatement | Sets and returns the custom SQL statement.
UserId | Sets and returns the OLE DB user Id.

SEE ALSO:

Automating Database Printing.

Databases Collection

Database Object

ODBC Object
TextFile Object

SAPIDoc Object


Password Property (OLE DB)

Description

Sets the password for an OLE DB database.

Access

Write Only

Syntax

object.Password[=Password]

The Password property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Password | Optional in VB, otherwise required. The password to the ODBC database.

Remarks

The Password property sets the password for the OLE DB database. The Password property will always return an empty string if read.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Setting the user ID

btDb.OLEDB.UserId = "Administrator"

'Setting the password

btDb.OLEDB.Password = "12345"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Setting the user ID

btDb.OLEDB.UserId = "Administrator";

//Setting the password

btDb.OLEDB.Password = "12345";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

OLEDB Object

SEE ALSO:

Database Object

Databases Collection Object

Automating Database Printing.


SQLStatement Property (OLE DB)

Description

Sets and returns the custom SQL statement.

Access

Read/Write

Syntax

object.SQLStatement[=Statement]

The SQLStatement property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Statement | Optional in VB, otherwise required. The SQL statement.

Remarks

The SQLStatement property sets and returns a custom SQL statement for record selection within an OLE DB database. The SQL statement will be applied at data browsing or print time to perform record filtering. Setting the SQLStatement property will imply the use of a custom SQL statement and the options found in the Tables, Query, Join, and Sort tabs of an OLE DB database will be ignored.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Setting the SQL statement

btDb.OLEDB.SQLStatement = "SELECT * FROM 'Customers' WHERE 'Name'='Frank Wild'"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Setting the SQL statement

btDb.OLEDB.SQLStatement = "SELECT * FROM 'Customers' WHERE 'Name'='Frank Wild'";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

OLEDB

SEE ALSO:

Database Object

Databases Collection Object

Automating Database Printing


UserId Property (OLE DB)

Description

Sets and returns the OLE DB user identification.

Access

Read/Write

Syntax

object.UserId[=ID]

The UserId property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
ID | Optional in VB, otherwise required. The user name for access to the OLE DB database.

Remarks

The UserId property sets and returns the user id for the selected OLE DB. If a user ID does not exist, then an empty string will be returned.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Setting the user ID

btDb.OLEDB.UserId = "Administrator"

'Setting the password

btDb.OLEDB.Password = "12345"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Setting the user ID

btDb.OLEDB.UserId = "Administrator";

//Setting the password

btDb.OLEDB.Password = "12345";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

OLEDB

SEE ALSO:

Database Object

Databases Collection Object

Automating Database Printing


PageSetup Object

Description

Used to access the page setup properties of the Format object.

Properties

The following properties are supported:

Property | Description
Inverse | Sets and returns whether text and background color are reversed (white on black).
LabelColumns | Sets and returns the number of columns on each page.
LabelCorners | Sets and returns whether the label corners are rounded or sharp.
LabelGapHorizontal | Sets and returns the size of the gap between columns of labels on a page.*
LabelGapManual | Sets and returns whether to give the LabelGapHorizontal and LabelGapVertical properties precedence over other page setup properties, in the event of conflicts, or whether to let the gap sizes be overridden by the other properties.
LabelGapVertical | Sets and returns the size of the gap between rows of labels on a page.*
LabelHeight | Sets and returns the height of each label.*
LabelHole | Sets and returns whether or not there is a hole in the label.
LableHoleDiameter | Sets and returns the diameter of the hole in the label.
LabelRows | Sets and returns the number of rows on each page.
LabelShape | Sets and returns whether label is rectangular or elliptical.
LabelSizeManual | Sets and returns whether to give the LabelHeight and LabelWidth properties precedence over other page setup properties, in the event of conflicts, or whether to let the label sizes be overridden by the other properties.
LabelWidth | Sets and returns the width of each label.*
MarginBottom | Sets and returns the bottom margin of the page.*
MarginLeft | Sets and returns the left-side margin of the page.
MarginRight | Sets and returns the right-side margin of the page.*
MarginTop | Sets and returns the top margin of the page.
MediaHandling | Returns a reference to the MediaHandling object.
Mirror | Sets and returns whether the label content is printed in mirror inversion.
Orientation | Sets and returns the page's orientation (portrait or landscape).
PaperHeight | Sets and returns the paper height.
PaperID | Sets and returns the printer driver's internal ID for the paper size, such as "A4" or "letter".
PaperName | Sets and returns the paper size, such as "A4" or "letter".
PaperWidth | Sets and returns the paper width.
StockCategory | Returns the name of the stock category, usually a label stock manufacturer. (This property is set with the SetStock method. See below)
StockType | Returns the name of the stock type, usually the label stock manufacturer's "model" name of the label stock. (This property is set with the SetStock method. See below)
Tray | Sets and returns the paper tray to be used in printing.
Valid | Returns whether or not the page setup properties are valid.

Note: The values of properties with an asterisk "*" above may be changed by BarTender in certain situations. See Automatic Adjustments to Page Setup Values for details.

Methods

The following method is supported:

Method | Description
SetStock | Sets the values of the StockCategory and StockType properties.


SetStock Method

Description

Sets the stock used for page setup.

Syntax

object.SetStock (StockCategory, StockType)

The SetStock method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
StockCategory | Required. String. A stock category.
StockType | Required. String. A stock type.

Remarks

Sets the stock used for page setup. If the stock is not found, then the call is ignored. (The StockCategory and StockType properties of the PageSetup object are not directly write-able.)

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the stock category and type

btPageSetup.SetStock("Brady", "BT-2030")

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the stock category and type

btPageSetup.SetStock("Brady", "BT-2030");

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup Object


Inverse Property

Description

Sets/returns whether the label printing is reversed (white on black).

Access

Read/Write

Syntax

object.Inverse [=true|false]

The Inverse property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | If true, then the label will be printed with reversed color (white on black).

Remarks

For objects that support this property, the black and white components are printed in reverse color.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'The label printing is inverted

btPageSetup.Inverse = True

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//The label printing is inverted

btPageSetup.Inverse = true;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


LabelColumns Property

LabelGapVertical Property

Description

Sets/returns the number of columns of labels on each page.

Access

Read/Write

Syntax

object.LabelColumns [=Value]

The LabelColumns property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Value | Required. The number of columns of labels on the stock.

Remarks

Sets/returns the number of columns of labels on each page.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the label columns

btPageSetup.LabelColumns = 2

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the label columns

btPageSetup.LabelColumns = 2;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


LabelCorners Property

Description

Sets/returns whether or not the label's corners are rounded or square.

Access

Read/Write

Syntax

object.LabelCorners [=BtShape]

The LabelCorners property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtShape | Required. Must be one of the odd-numbered BtShape constants. See below.

Settings

The BtShape argument can have either of the two odd-numbered settings:

Constant | Value | Description
btSquare | 1 | The rectangular label will have square corners.
btRound | 3 | The rectangular label will have rounded corners.

Remarks

Sets/returns, as a Long data type, btRound if the corners of the label are rounded. Otherwise, returns btSquare because the corners are square. This property is only valid when LabelShape = btRectangle.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the label shape to rectangle

btPageSetup.LabelShape = btRectangle

'Setting the label corners round

btPageSetup.LabelCorners = BarTender.BtShape.btRound

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the label shape to rectangle

btPageSetup.LabelShape = btRectangle

//Setting the label corners round

btPageSetup.LabelCorners = BarTender.BtShape.btRound;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


LabelGapHorizontal Property

Description

Sets/returns the size of the gaps between columns of labels.

Access

Read/Write

Syntax

object.LabelGapHorizontal([BtUnits])[=Value]

The LabelGapHorizontal property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtUnits | Optional in VB, otherwise required. Any of the BtUnits constants. See below.
Value | Required. A Float.

Settings

The BtUnits argument can have any of the following settings:

Constant | Value | Description
btUnitsCurrent | 0 | Use the unit of measure that is currently set as standard. Default.
btUnitsInches | 1 | Use inches as the unit of measure.
btUnitsCentimeters | 2 | Use centimeters as the unit of measure.
btUnitsMillimeters | 3 | Use millimeters as the unit of measure.

Remarks

Sets/returns (in the units specified) the size of the gaps between columns of labels. Setting this property also sets the LabelGapManual property to true. If that effect is not wanted, reset the LabelGapManual property to false immediately after setting the gap sizes.

Note: The value of this property may be changed by BarTender in certain situations. See Automatic Adjustments to Page Setup Values for details.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the horizontal gap in current units

btPageSetup.LabelGapHorizontal(BarTender.BtUnits.btUnitsCurrent) = 0.1

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the horizontal gap in current units

btPageSetup.set_LabelGapHorizontal(BarTender.BtUnits.btUnitsCurrent, 0.1f);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


LabelGapManual Property

Description

Returns, or should be set to, true if the sizes of the gaps between labels on a page have priority over other size properties of the PageSetup object, in the event the properties are inconsistent. See Automatic Adjustments to Page Setup Values for details.

Access

Read/Write

Syntax

object.LabelGapManual [=true|false]

The LabelGapManual property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Required. If true, then gap sizes will have precedence over other size properties of the PageSetup object, in the event of conflicts.

Remarks

Returns, or should be set to, true if the sizes of the gaps between labels on a page have priority over other size properties of the PageSetup object, in the event the properties are inconsistent. See Automatic Adjustments to Page Setup Values for details. This property is set to true whenever the LabelGapVertical or LabelGapHorizontal properties are changed. If that effect is not wanted, reset this property to false immediately after setting the gap sizes.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Label gap sizes are being set manually

btPageSetup.LabelGapManual = True

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Label gap sizes are being set manually

btPageSetup.LabelGapManual = true;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


LabelGapVertical Property

Description

Sets/returns the size of the gap between rows of labels.

Access

Read/Write

Syntax

object.LabelGapVertical([BtUnits])[=Value]

The LabelGapVertical property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtUnits | Optional in VB, otherwise required. Any of the BtUnits constants. See below.
Value | Required. A Float.

Settings

The BtUnits argument can have any of the following settings:

Constant | Value | Description
btUnitsCurrent | 0 | Use the unit of measure that is currently set as standard. Default.
btUnitsInches | 1 | Use inches as the unit of measure.
btUnitsCentimeters | 2 | Use centimeters as the unit of measure.
btUnitsMillimeters | 3 | Use millimeters as the unit of measure.

Remarks

Sets/returns (in the units specified) the size of the gap between rows of labels. Setting this property also sets the LabelGapManual property to true. If that effect is not wanted, reset the LabelGapManual property to false immediately after setting the gap sizes.

Note: The value of this property may be changed by BarTender in certain situations. See Automatic Adjustments to Page Setup Values for details.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the vertical gap in current units

btPageSetup.LabelGapVertical(BarTender.BtUnits.btUnitsCurrent) = 0.1

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the vertical gap in current units

btPageSetup.set_LabelGapVertical(BarTender.BtUnits.btUnitsCurrent, 0.1f);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


LabelHeight Property

Description

Sets/returns the label's height in the units specified.

Access

Read/Write

Syntax

object.LabelHeight([BtUnits])[=Value]

The LabelHeight property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtUnits | Optional in VB, otherwise required. Any of the BtUnits constants. See below.
Value | Required. A Float.

Settings

The BtUnits argument can have any of the following settings:

Constant | Value | Description
btUnitsCurrent | 0 | Use the unit of measure that is currently set as standard. Default.
btUnitsInches | 1 | Use inches as the unit of measure.
btUnitsCentimeters | 2 | Use centimeters as the unit of measure.
btUnitsMillimeters | 3 | Use millimeters as the unit of measure.

Remarks

Sets/returns the height of each label in the units specified. Setting this property also sets the LabelSizeManual property to true. If that effect is not wanted, reset the LabelSizeManual property to false immediately after setting the height.

Note: The value of this property may be changed by BarTender in certain situations. See Automatic Adjustments to Page Setup Values for details.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the label height in current units

btPageSetup.LabelHeight(BarTender.BtUnits.btUnitsCurrent) = 6.1

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the label height in current units

btPageSetup.set_LabelHeight(BarTender.BtUnits.btUnitsCurrent, 6.1f);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


LabelHole Property

Description

Returns and sets whether the label format has a hole.

Access

Read/Write

Syntax

object.LabelHole [=true|false]

The LabelHole property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | If true, then the label has a hole.

Remarks

This property is only valid when LabelShape = btEllipse.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the label shape to be an ellipse

btPageSetup.LabelShape = BarTender.BtShape.btEllipse

'The label has a hole

btPageSetup.LabelHole = True

'Setting the hole diameter in millimeters

btPageSetup.LabelHoleDiameter(BarTender.BtUnits.btUnitsMillimeters) = 20

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the label shape to be an ellipse

btPageSetup.LabelShape = BarTender.BtShape.btEllipse;

//The label has a hole

btPageSetup.LabelHole = true;

//Setting the hole diameter in millimeters

btPageSetup.set_LabelHoleDiameter(BarTender.BtUnits.btUnitsMillimeters, 20.2f);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


LabelHoleDiameter Property

Description

Sets/returns the diameter of the hole in the label in the units specified.

Access

Read/Write

Syntax

object.LabelHoleDiameter([BtUnits])[=Value]

The LabelHoleDiameter property has the following

parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtUnits | Optional in VB, otherwise required. Any of the BtUnits constants. See below.
Value | Required. A Float.

Settings

The BtUnits argument can have any of the following settings:

Constant | Value | Description
btUnitsCurrent | 0 | Use the unit of measure that is currently set as standard. Default.
btUnitsInches | 1 | Use inches as the unit of measure.
btUnitsCentimeters | 2 | Use centimeters as the unit of measure.
btUnitsMillimeters | 3 | Use millimeters as the unit of measure.

Remarks

This property is only valid when LabelHole = true and LabelShape = btEllipse.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the label shape to be an ellipse

btPageSetup.LabelShape = BarTender.BtShape.btEllipse

'The label has a hole

btPageSetup.LabelHole = True

'Setting the hole diameter in millimeters

btPageSetup.LabelHoleDiameter(BarTender.BtUnits.btUnitsMillimeters) = 20

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the label shape to be an ellipse

btPageSetup.LabelShape = BarTender.BtShape.btEllipse;

//The label has a hole

btPageSetup.LabelHole = true;

//Setting the hole diameter in millimeters

btPageSetup.set_LabelHoleDiameter(BarTender.BtUnits.btUnitsMillimeters, 20.2f);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


LabelRows Property

Description

Sets/returns the number of rows of labels on each page.

Access

Read/Write

Syntax

object.LabelRows [=Value]

The LabelRows property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Value | Required. The number of rows of labels on the stock.

Remarks

Sets/returns the number of rows of labels on each page.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the label rows

btPageSetup.LabelRows = 4

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the label rows

btPageSetup.LabelRows = 4;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


LabelShape Property

Description

Sets/returns the basic label shape, either rectangular or elliptical.

Access

Read/Write

Syntax

object.LabelShape [=BtShape]

The LabelShape property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtShape | Required. Must be one of the even-numbered BtShape constants. See below.

Settings

The BtShape argument can have either of the two even-numbered settings:

Constant | Value | Description
btRectangle | 2 | The label will be rectangular.
btEllipse | 4 | The label will be circular or elliptical.

Remarks

Sets/returns either btRectangle or btEllipse as data type Long.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the label shape to rectangle

btPageSetup.LabelShape = btRectangle

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the label shape to rectangle

btPageSetup.LabelShape = btRectangle

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


LabelSizeManual Property

Description

Returns, or should be set to, true if label dimensions have priority over other size properties of the PageSetup object, in the event the properties are inconsistent. See Automatic Adjustments to Page Setup Values for details.

Access

Read/Write

Syntax

object.LabelSizeManual [=true|false]

The LabelSizeManual property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Required. If true, then label dimensions will have precedence over other size properties of the PageSetup object, in the event of conflicts.

Remarks

Returns, or should be set to, true if label dimensions have priority over other size properties of the PageSetup object, in the event the properties are inconsistent. See Automatic Adjustments to Page Setup Values for details. This property is set to true whenever the LabelHeight or LabelWidth properties are changed. If that effect is not wanted, reset this property to false immediately after setting the height or width.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Label size is being set manually

btPageSetup.LabelSizeManual = True

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Label size is being set manually

btPageSetup.LabelSizeManual = true;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


LabelWidth Property

Description

Sets/returns the width of each label in the units specified.

Access

Read/Write

Syntax

object.LabelWidth([BtUnits])[=Value]

The LabelWidth property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtUnits | Optional in VB, otherwise required. Any of the BtUnits constants. See below.
Value | Required. A Float.

Settings

The BtUnits argument can have any of the following settings:

Constant | Value | Description
btUnitsCurrent | 0 | Use the unit of measure that is currently set as standard. Default.
btUnitsInches | 1 | Use inches as the unit of measure.
btUnitsCentimeters | 2 | Use centimeters as the unit of measure.
btUnitsMillimeters | 3 | Use millimeters as the unit of measure.

Remarks

Sets/returns the width of each label in the units specified. Setting this property also sets the LabelSizeManual property to true. If that effect is not wanted, reset the LabelSizeManual property to false immediately after setting the width.

Note: The value of this property may be changed by BarTender in certain situations. See Automatic Adjustments to Page Setup Values for details.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the label width in current units

btPageSetup.LabelWidth(BarTender.BtUnits.btUnitsCurrent) = 6.1

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the label width in current units

btPageSetup.set_LabelWidth(BarTender.BtUnits.btUnitsCurrent, 6.1f);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


MarginBottom Property

Description

Sets/returns the size of the bottom margin of the paper, in the units specified.

Access

Read/Write

Syntax

object.MarginBottom([BtUnits])[=Value]

The MarginBottom property has the following

parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtUnits | Optional in VB, otherwise required. Any of the BtUnits constants. See below.
Value | Required. A Float.

Settings

The BtUnits argument can have any of the following settings:

Constant | Value | Description
btUnitsCurrent | 0 | Use the unit of measure that is currently set as standard. Default.
btUnitsInches | 1 | Use inches as the unit of measure.
btUnitsCentimeters | 2 | Use centimeters as the unit of measure.
btUnitsMillimeters | 3 | Use millimeters as the unit of measure.

Remarks

Sets/returns the size of the bottom margin of the paper, in the units specified.

Note: The value of this property may be changed by BarTender in certain situations. See Automatic Adjustments to Page Setup Values for details.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the bottom margin in centimeters

btPageSetup.MarginBottom(BarTender.BtUnits.btUnitsCentimeters) = 2

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the bottom margin in centimeters

btPageSetup.set_MarginBottom(BarTender.BtUnits.btUnitsCentimeters, 2);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


MarginLeft Property

Description

Sets/returns the size of the left margin of the paper, in the units specified.

Access

Read/Write

Syntax

object.MarginLeft([BtUnits])[=Value]

The MarginLeft property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtUnits | Optional in VB, otherwise required. Any of the BtUnits constants. See below.
Value | Required. A Float.

Settings

The BtUnits argument can have any of the following settings:

Constant | Value | Description
btUnitsCurrent | 0 | Use the unit of measure that is currently set as standard. Default.
btUnitsInches | 1 | Use inches as the unit of measure.
btUnitsCentimeters | 2 | Use centimeters as the unit of measure.
btUnitsMillimeters | 3 | Use millimeters as the unit of measure.

Remarks

Sets/returns the size of the left margin of the paper, in the units specified.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the left margin in centimeters

btPageSetup.MarginLeft(BarTender.BtUnits.btUnitsCentimeters) = 2

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the left margin in centimeters

btPageSetup.set_MarginLeft(BarTender.BtUnits.btUnitsCentimeters, 2);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


MarginRight Property

Description

Sets/returns the size of the right margin of the paper, in the units specified.

Access

Read/Write

Syntax

object.MarginRight([BtUnits])[=Value]

The MarginRight property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtUnits | Optional in VB, otherwise required. Any of the BtUnits constants. See below.
Value | Required. A Float.

Settings

The BtUnits argument can have any of the following settings:

Constant | Value | Description
btUnitsCurrent | 0 | Use the unit of measure that is currently set as standard. Default.
btUnitsInches | 1 | Use inches as the unit of measure.
btUnitsCentimeters | 2 | Use centimeters as the unit of measure.
btUnitsMillimeters | 3 | Use millimeters as the unit of measure.

Remarks

Returns the size of the right margin of the paper, in the units specified.

Note: The value of this property may be changed by BarTender in certain situations. See Automatic Adjustments to Page Setup Values for details.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the right margin in centimeters

btPageSetup.MarginRight(BarTender.BtUnits.btUnitsCentimeters) = 2

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the right margin in centimeters

btPageSetup.set_MarginRight(BarTender.BtUnits.btUnitsCentimeters, 2);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


MarginTop Property

Description

Sets/returns the size of the top margin of the paper, in the units specified.

Access

Read/Write

Syntax

object.MarginTop([BtUnits])[=Value]

The MarginTop property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtUnits | Optional in VB, otherwise required. Any of the BtUnits constants. See below.
Value | Required. A Float.

Settings

The BtUnits argument can have any of the following settings:

Constant | Value | Description
btUnitsCurrent | 0 | Use the unit of measure that is currently set as standard. Default.
btUnitsInches | 1 | Use inches as the unit of measure.
btUnitsCentimeters | 2 | Use centimeters as the unit of measure.
btUnitsMillimeters | 3 | Use millimeters as the unit of measure.

Remarks

Sets/returns the size of the top margin of the paper, in the units specified.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the top margin in centimeters

btPageSetup.MarginTop(BarTender.BtUnits.btUnitsCentimeters) = 2

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the top margin in centimeters

btPageSetup.set_MarginTop(BarTender.BtUnits.btUnitsCentimeters, 2);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


MediaHandling Property

Description

Returns a reference to the MediaHandling object.

Access

Read Only

Syntax

object.MediaHandling

The MediaHandling property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The MediaHandling property returns a reference to the format's MediaHandling object, which controls the settings for any media handling actions and their triggers.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender MediaHandling variable

Dim btMediaHandling As BarTender.PageSetup.MediaHandling

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the MediaHandling variable

btMediaHandling = btFormat.PageSetup.MediaHandling

'Setting the MediaHandling object's Cut property

btMediaHandling = BarTender.BtMediaHandlingAction.btMHCut

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender MediaHandling variable

BarTender.PageSetup.MediaHandling btMediaHandling;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the MediaHandling variable

btMediaHandling=btFormat.PageSetup.MediaHandling;

//Selecting the cut action

btMediaHandling.Action = BarTender.BtMediaHandlingAction.btMHCut;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

MediaHandling


Mirror Property

Description

Returns and sets whether the label content is printed using mirror inversion.

Access

Read/Write

Syntax

object.Mirror [=true|false]

The Mirror property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | If true, then the label will be printed in mirror view.

Remarks

Sets the label format to print out as if viewed in a mirror.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'The label is printed in mirror view

btPageSetup.Mirror = True

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//The label is printed in mirror view

btPageSetup.Mirror = true;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


Orientation Property

Description

Sets/returns the orientation of the paper, either portrait or landscape.

Access

Read/Write

Syntax

object.Orientation[=BtOrientation]

The Orientation property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtOrientation | Required. Any of the BtOrientation constants. See below.

Settings

The BtOrientation argument can have any of the following settings:

Constant | Value | Description
btPortrait | 0 | Each page of label stock is higher than it is wide.
btLandscape | 1 | Each page of label stock is wider than it is high.
btPortrait180 | 2 | Portrait orientation, rotated 180 degrees.
btLandscape180 | 3 | Landscape orientation, rotated 180 degrees.

Remarks

Here is an example of the Orientation property in use.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the orientation to landscape

btPageSetup.Orientation = BarTender.BtOrientation.btLandscape

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the orientation to landscape

btPageSetup.Orientation = BarTender.BtOrientation.btLandscape;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


PaperID Property

Description

Sets/returns the paper ID, a number (datatype Long) that represents a page size such as A4 or "letter." This is the printer driver's internal equivalent of PaperName.

Access

Read/Write

Syntax

object.PaperID[=Value]

The PaperID property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Value | Required. Long integer. The possible values are defined in the file wingdi.h included with the Windows SDK.

Remarks

Sets/returns the paper ID, a number (datatype Long) that represents a page size such as A4 or "letter." This is the printer driver's internal equivalent of PaperName. The possible values are listed on the Microsoft Developer Network (MSDN) web site at the link below. If the link is no longer valid, go to www.msdn.com and search for "PaperSize".

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaac11/html/PaperSizeValues_HV05188251.asp

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the paper ID

btPageSetup.PaperID = 1

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the paper ID

btPageSetup.PaperID = 1;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


PaperName Property

Description

Sets/returns the paper size as a string, such as "A4" or "letter". Compare with PaperID.

Access

Read/Write

Syntax

object.PaperName[=PaperSize]

The PaperName property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
PaperSize | Required. Any string.

Remarks

Sets/returns the paper size as a string, such as "A4" or "letter". Compare with PaperID.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the paper name

btPageSetup.PaperName = "Letter"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the paper name

btPageSetup.PaperName = "Letter"

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


PaperHeight Property

Description

Sets/returns the height of the paper stock in the units specified.

Access

Read/Write

Syntax

object.PaperHeight([BtUnits])[=Value]

The PaperHeight property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtUnits | Optional in VB, otherwise required. Any of the BtUnits constants. See below.
Value | Required. A Float.

Settings

The BtUnits argument can have any of the following settings:

Constant | Value | Description
btUnitsCurrent | 0 | Use the unit of measure that is currently set as standard. Default.
btUnitsInches | 1 | Use inches as the unit of measure.
btUnitsCentimeters | 2 | Use centimeters as the unit of measure.
btUnitsMillimeters | 3 | Use millimeters as the unit of measure.

Remarks

Sets/returns the height of the paper stock in the units specified.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the paper height in current units

btPageSetup.PaperHeight(BarTender.BtUnits.btUnitsCurrent) = 6.1

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the label height in current units

btPageSetup.set_LabelHeight(BarTender.BtUnits.btUnitsCurrent, 6.1f);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


PaperWidth Property

Description

Sets/returns the width of the paper stock in the units specified.

Access

Read/Write

Syntax

object.PaperWidth([BtUnits])[=Value]

The PaperWidth property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtUnits | Optional in VB, otherwise required. Any of the BtUnits constants. See below.
Value | Required. A Float.

Settings

The BtUnits argument can have any of the following settings:

Constant | Value | Description
btUnitsCurrent | 0 | Use the unit of measure that is currently set as standard. Default.
btUnitsInches | 1 | Use inches as the unit of measure.
btUnitsCentimeters | 2 | Use centimeters as the unit of measure.
btUnitsMillimeters | 3 | Use millimeters as the unit of measure.

Remarks

Sets/returns the width of the paper stock in the units specified.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the paper width in current units

btPageSetup.PaperWidth(BarTender.BtUnits.btUnitsCurrent) = 4.1

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the label width in current units

btPageSetup.set_LabelWidth(BarTender.BtUnits.btUnitsCurrent, 4.1f);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


StockCategory Property

Description

Returns the name of the label stock category, typically a manufacturer of label stock.

Access

Read Only. See the SetStock method for write access.

Syntax

object.StockCategory

The StockCategory property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

Returns the name of the label stock category, typically a manufacturer of label stock.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the stock category and type

btPageSetup.SetStock("Brady", "BT-2030")

'Displaying the stock category

MessageBox.Show(btPageSetup.StockCategory)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the stock category and type

btPageSetup.SetStock("Brady", "BT-2030");

//Displaying the stock category

MessageBox.Show(btPageSetup.StockCategory);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


StockType Property

Description

Returns the name of the stock type.

Access

Read Only. See the SetStock method for write access.

Syntax

object.StockType

The StockType property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

Returns the name of the stock type.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the stock category and type

btPageSetup.SetStock("Brady", "BT-2030")

'Displaying the stock type

MessageBox.Show(btPageSetup.StockType)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Setting the stock category and type

btPageSetup.SetStock("Brady", "BT-2030");

//Displaying the stock type

MessageBox.Show(btPageSetup.StockType);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


Tray Property

Description

Sets/returns the paper tray used for printing. Only used with page printers.

Access

Read/Write

Syntax

object.Tray[=TrayNameValue]

The Tray property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
TrayNameValue | String. The name of the page printer tray to be used.

Remarks

Sets/returns the paper tray for the label format stock if a tray other than the default is desired.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Setting the paper tray

btPageSetup.Tray="Tray 1"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup;

//Setting the paper tray value

btPageSetup="Tray 1";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


Valid Property

Description

Returns true if there are no inconsistencies in the other properties of the PageSetup object (i.e. a label width larger than the paper width), otherwise returns false.

Access

Read Only

Syntax

object.Valid

The Valid property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

Returns true if there are no inconsistencies in the other properties of the PageSetup object (i.e. a label width larger than the paper width), otherwise returns false.

Note: BarTender will attempt to change some page setup values in order to make them valid if it can. See Automatic Adjustments to Page Setup Values for details.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender page setup variable

Dim btPageSetup As BarTender.PageSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the page setup variable

btPageSetup = btFormat.PageSetup

'Displaying whether or not the page setup is valid

MessageBox.Show(btPageSetup.Valid.ToString)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender page setup variable

BarTender.PageSetup btPageSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the page setup variable

btPageSetup = btFormat.PageSetup

//Displaying whether or not the page setup is valid

MessageBox.Show(btPageSetup.Valid.ToString);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PageSetup


Performance Object

Description

The Performance object controls configuration of the printer for maximum performance. It can be the child of either a PrintSetup object or a PrinterCodeTemplate object.

Properties

The following properties are supported:

Property | Description
AllowFormatCaching | Sets and returns whether the printer will cache (store) the formatting information for the label such as object positions, symbologies, font size, line and box colors, etc. between print jobs. (It will not store a bitmap of the label or any objects on the label.) This property is not available if the object is the child of a PrinterCodeTemplate object.
AllowGraphicsCaching | Sets and returns whether the printer will cache (store) each graphic and each unchanging text area that uses a TrueType or OpenType font (that has not been downloaded). This property is not available if the object is the child of a PrinterCodeTemplate object.
AllowSerialization | Sets and returns whether the printer will use its built-in serialization feature.
AllowStaticGraphics | Sets and returns whether the printer will store, for the duration of the print job, all raster-type graphic objects, including TrueType fonts, that print out exactly the same from label to label.
AllowStaticObjects | Sets and returns the option to have the printer store, for the duration of the print job, all objects on the label format that do not contain data that varies from label-to-label. This includes printer fonts, bar codes, imported graphics, and TrueType fonts.
AllowVariableDataOptimization | Sets and returns whether printers that have a merge data feature will use it.
WarnWhenUsingTrueTypeFonts | Sets and returns whether the printer will warn the user that TrueType fonts are being used on the label format.

Remarks

Each of these property settings is ignored if the printer does not support the corresponding feature.


AllowFormatCaching Property

Description

Sets and returns whether the printer will store the formatting information for the label such as object positions, symbologies, font size, line and box colors, etc. between print jobs. (It will not store a bitmap of the label or any objects on the label.) The printer can then retrieve from the cache any formats that are reused on later print jobs.

Access

Read/Write

Syntax

object.AllowFormatCaching[={true|false}]

The AllowFormatCaching property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Required. If true, the cache will be used.

Remarks

If the printer does not support this feature, the setting of this property is ignored.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Declaring the BarTender performance variable

Dim btPerformance As BarTender.Performance

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Selecting the performance variable

btPerformance = btPrintSetup.Performance

'Setting the format caching property

btPerformance.AllowFormatCaching = True

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Declaring the BarTender performance variable

BarTender.Performance btPerformance;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Selecting the performance variable

btPerformance = btPrintSetup.Performance;

//Setting the format caching property

btPerformance.AllowFormatCaching = true;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Performance Object


AllowGraphicsCaching Property

Description

Sets and returns whether the printer will cache (store) each graphic and each unchanging text area that uses a TrueType or OpenType font (that has not been downloaded). The printer can then retrieve from the cache any formats that are reused on other print jobs.

Access

Read/Write

Syntax

object.AllowGraphicsCaching[={true|false}]

The AllowGraphicsCaching property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Required. If true, the cache will be used.

Remarks

If the printer does not support this feature, the setting of this property is ignored.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Declaring the BarTender performance variable

Dim btPerformance As BarTender.Performance

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Selecting the performance variable

btPerformance = btPrintSetup.Performance

'Setting the format caching property

btPerformance.AllowGraphicsCaching = True

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Declaring the BarTender performance variable

BarTender.Performance btPerformance;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Selecting the performance variable

btPerformance = btPrintSetup.Performance;

//Setting the format caching property

btPerformance.AllowGraphicsCaching = true;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Performance Object


AllowSerialization Property

Description

Sets and returns whether the printer will use its built-in serialization feature.

Access

Read/Write

Syntax

object.AllowSerialization [={true|false}]

The AllowSerialization property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Required. If true, the printer's built-in serialization will be used.

Remarks

If the printer does not support this feature, the setting of this property is ignored.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Declaring the BarTender performance variable

Dim btPerformance As BarTender.Performance

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Selecting the performance variable

btPerformance = btPrintSetup.Performance

'Setting the format caching property

btPerformance.AllowSerialization = True

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Declaring the BarTender performance variable

BarTender.Performance btPerformance;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Selecting the performance variable

btPerformance = btPrintSetup.Performance;

//Setting the format caching property

btPerformance.AllowSerialization = true;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Performance Object


AllowStaticGraphics Property

Description

Sets and returns whether the printer will store, for the duration of the print job, all raster-type graphic objects, including TrueType fonts, that print out exactly the same from label to label.

Access

Read/Write

Syntax

object.AllowStaticGraphics[={true|false}]

The AllowStaticGraphics property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Required. If true, static raster graphics and TrueType fonts will be stored in the printer's cache.

Remarks

If the printer does not support this feature, the setting of this property is ignored.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Declaring the BarTender performance variable

Dim btPerformance As BarTender.Performance

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Selecting the performance variable

btPerformance = btPrintSetup.Performance

'Setting the format caching property

btPerformance.AllowStaticGraphics = True

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Declaring the BarTender performance variable

BarTender.Performance btPerformance;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Selecting the performance variable

btPerformance = btPrintSetup.Performance;

//Setting the format caching property

btPerformance.AllowStaticGraphics = true;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Performance Object


AllowStaticObjects Property

Description

Sets and returns the option to have the printer store, for the duration of the print job, all objects on the label format that do not contain data that varies from label-to-label. The printer will add to each label the objects that do vary. This includes printer fonts, bar codes, imported graphics, and TrueType fonts.

Access

Read/Write

Syntax

object.AllowStaticObjects[={true|false}]

The AllowStaticObjects property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Required. If true, static objects will be stored in the printer's memory cache.

Remarks

If the printer does not support this feature, the setting of this property is ignored.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Declaring the BarTender performance variable

Dim btPerformance As BarTender.Performance

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Selecting the performance variable

btPerformance = btPrintSetup.Performance

'Setting the format caching property

btPerformance.AllowStaticObjects = True

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Declaring the BarTender performance variable

BarTender.Performance btPerformance;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Selecting the performance variable

btPerformance = btPrintSetup.Performance;

//Setting the format caching property

btPerformance.AllowStaticObjects = true;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Performance Object


AllowVariableDataOptimization Property

Description

Sets and returns whether the printer will use its data merge feature, if it has that feature. When true the printer will store, for the duration of the print job, formatting information (object positions, symbology, font name and size, line and box colors, etc.) for both static and variable objects. Only the content of the objects will have to be sent to the printer on a label-by-label basis, and if the content is also being stored by means of the AllowStaticObjects property then only the content of variable objects will have to be sent to the printer for each label. The printer will merge this data into the appropriate fields on the label.

Access

Read/Write

Syntax

object.AllowVariableDataOptimization[={true|false}]

The AllowVariableDataOptimization property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Required. If true, the cache will be used.

Remarks

If the printer does not support this feature, the setting of this property is ignored.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Declaring the BarTender performance variable

Dim btPerformance As BarTender.Performance

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Selecting the performance variable

btPerformance = btPrintSetup.Performance

'Setting the format caching property

btPerformance.AllowVariableDataOptimization = True

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Declaring the BarTender performance variable

BarTender.Performance btPerformance;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Selecting the performance variable

btPerformance = btPrintSetup.Performance;

//Setting the format caching property

btPerformance.AllowVariableDataOptimization = true;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Performance Object


WarnWhenUsingTrueTypeFonts Property

Description

Sets and returns whether or not the printer will warn the user that TrueType fonts are being used on the label format.

Access

Read/Write

Syntax

object.WarnWhenUsingTrueTypeFonts[={true|false}]

The WarnWhenUsingTrueTypeFonts property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Required. If true, the user will be warned that the label has TrueType fonts.

Remarks

If the printer does not support this feature, the setting of this property is ignored.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Declaring the BarTender performance variable

Dim btPerformance As BarTender.Performance

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Selecting the performance variable

btPerformance = btPrintSetup.Performance

'Setting the warn when using true type fonts property

btPerformance.WarnWhenUsingTrueTypeFonts = True

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Declaring the BarTender performance variable

BarTender.Performance btPerformance;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Selecting the performance variable

btPerformance = btPrintSetup.Performance;

//Setting the warn when using true type fonts property

btPerformance.WarnWhenUsingTrueTypeFonts = true;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Performance


PrinterCodeTemplate Object

Description

The PrinterCodeTemplate object can be used to export the current label to a printer template, or to separate printer template for the label formatting information and the data.

Properties

The following properties are supported:

Property | Description
ExportAsVersion | Returns a reference to the ExportAsVersion object.
Job | Returns a reference to the Job object.
Performance | Returns a reference to the Performance object.
PrintMethod | Returns a reference to the PrintMethod object.

Methods

The following methods are supported:

Method | Description
Export | Exports the current label format to a single printer template file.

SEE ALSO:

Understanding Printer Code Template Files

Using the PrinterCodeTemplate Object


Export Method

Description

Exports the current format to either a single printer template or one template for formatting information and a second for variable data. The method also records any warnings or errors in a Messages collection.

Syntax

[success =] object.Export (PrintSystem, BtSaveOptions, OutputFormatFile, OutputDataFile, Messages)

The Export method has the following parts:

Part | Description
success | Optional in VB, otherwise required. Will be assigned true if the template is created, false if an error prevents creation of the template.
object | Required. An object expression that evaluates to an object in the Applies To list.
PrintSystem | Required. A string identifying the print system to be used.
BtSaveOptions | Required. Specifies whether to create one or two templates. Any of the BtSaveOptions constants. See below.
OutputFormatFile | Required. A string identifying the path and file name of the template, or the format template if BtSaveOptions is btPctExportSeparate.
OutputDataFile | Required (but ignored if BtSaveOptions is btPctExportCombined). A string identifying the path and file name of the data template.
Messages | Required. An object expression that evaluates to the name of a Messages collection.

Settings

The BtSaveOptions argument can have any of the following settings:

Constant | Value | Description
btPctExportSeparate | 0 | Separate templates are created for formatting information and data fields.
btPctExportCombined | 1 | A single template is created containing formatting information and data fields.

Remarks

The PrintSystem value must be an exact match for one of the print systems listed on the Printer Code Template Setup dialog. BarTender will validate the settings.

  • If there is an error condition, success will be assigned false and the template will not be created.

  • If there is a warning condition, success will be assigned true and the template will be created.

  • If there is either a warning or error condition, a Message object will be created for every error or warning condition.

  • If there is no warning or error condition, success will be assigned true, the template will be created, and no Message objects will be created.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate,
"c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the messages variable to the object

btMessages = obj as BarTender.Messages;

//Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PrinterCodeTemplate Object


ExportAsVersion Property

Description

Sets/Returns the ExportAsVersion property. Used with PCT Export to determine the version of the exported template code.

Access

Read/Write

Syntax

object.ExportAsVersion[=BtPctExportVersion]

The ExportAsVersion property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtPctExportVersion | Required. Any of the BtPctExportVersion constants. See below.

Settings

The BtPctExportVersion argument can have any of the following settings:

Constant | Value | Description
btPctExportVersion773AndEarlier | 0 | Uses prior version settings.
btPctExportVersionCurrent | 1 | Uses current version settings.

Remarks

The ExportAsVersion property is a value which controls whether or not BarTender will export the associated Printer Code Template file using the current version settings or those from older versions.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender messages variable to hold all messages

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Setting the export version

btPrinterCodeTemplate.ExportAsVersion=BtPctExportVersion.btPctExportVersionCurrent

'Exporting the printer code template

ExportSuccess = btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring a sucess variable

bool ExportSuccess;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Setting the export version

btPrinterCodeTemplate.ExportAsVersion=BtPctExportVersion.btPctExportVersionCurrent;

//Exporting the printer code template

ExportSuccess = btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate,
"c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn",
ref obj);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PrinterCodeTemplate


Job Property

Description

Returns a reference to the Job object.

Access

Read Only

Syntax

object.Job

The Job property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Job property returns a reference to the format's Job object, which controls certain job options, such as number of copies, when exporting a printer code template.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender job variable

Dim btJob As BarTender.Job

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Setting the job variable

btJob = btPrinterCodeTemplate.Job

'Setting the printer copies type property

btJob.PrinterCopiesType = BarTender.BtPrinterCopiesValueType.btPrinterCopiesConstant

'Setting the printer copies property

btJob.PrinterCopies = "2"

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender job variable

BarTender.Job btJob;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Setting the job variable

btJob = btPrinterCodeTemplate.Job;

//Setting the printer copies type property

btJob.FormatIdType = btJob.PrinterCopiesType = BarTender.BtPrinterCopiesValueType.btPrinterCopiesConstant;

//Setting the printer copies property

btJob.PrinterCopies = "2";

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, "c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the message variable to the object

btMessages = obj as BarTender.Messages;

//Getting the messages text

MessageBox.Show(btMessages.GetMessage(1).Message);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PrinterCodeTemplate


Performance Property

Description

Returns a reference to the Performance object.

Access

Read Only

Syntax

object.Performance

The Performance property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Performance property returns a reference to the format's Performance object, which which controls certain printer performance options.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Declaring the BarTender performance variable

Dim btPerformance As BarTender.Performance

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Selecting the performance variable

btPerformance = btPrintSetup.Performance

'Setting the format caching property

btPerformance.AllowFormatCaching = True

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Declaring the BarTender performance variable

BarTender.Performance btPerformance;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Selecting the performance variable

btPerformance = btPrintSetup.Performance;

//Setting the format caching property

btPerformance.AllowFormatCaching = true;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PrintSetup

PrinterCodeTemplate


PrintMethod Property

Description

Returns a reference to the PrintMethod object.

Access

Read Only

Syntax

object.PrintMethod

The PrintMethod property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The PrintMethod property returns a reference to the format's PrintMethod object, which controls whether or not BarTender will treat the following as raster graphics when they are not supported by the printer: TrueType fonts, lines, boxes, and bar codes that use a symbology unsupported by the printer.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Declaring the BarTender PrintMethod variable

Dim btPrintMethod As BarTender.Performance

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Setting the PrintMethod variable

btPrintMethod = btFormat.PrintMethod

'Setting the PrintMethod's boxes property

btPrintMethod.Boxes = BarTender.BtBoxPrintMethod.btBoxAuto

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Declaring the BarTender performance variable

BarTender.PrintMethod btPrintMethod;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Selecting the performance variable

btPrintMethod = btPrintSetup.PrintMethod;

//Setting the PrintMethod's boxes property

btPrintMethod.Boxes = BarTender.BtBoxPrintMethod.btBoxAuto;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PrintSetup

PrinterCodeTemplate


PrintMethod Object

Description

The PrintMethod object controls whether or not BarTender will treat the following as raster graphics when they are not supported by the printer: TrueType fonts, lines, boxes, and bar codes that use a symbology unsupported by the printer. This object can be the child of either a PrintSetup object or a PrinterCodeTemplate object.

Properties

The following properties are supported:

Property | Description
Boxes | Sets and returns whether boxes will be printed as raster graphics or as device lines when box objects are not supported by the printer.
Lines | Sets and returns whether lines will be printed as raster graphics or as device lines when line objects are not supported by the printer.
Ellipses | Sets and returns whether ellipses will be printed as raster graphics or as device lines when ellipse objects are not supported by the printer.
TrueTypeText | Sets and returns whether TrueType fonts will be treated as raster graphics or as text.
Unsupported1DBarCodes | Sets and returns whether bar codes using one-dimensional symbologies unsupported by the printer will be printed as raster graphics or as device lines.
Unsupported2DBarCodes | Sets and returns whether bar codes using two-dimensional symbologies unsupported by the printer will be printed as raster graphics or as device lines.


Boxes Property

Description

Sets and returns whether boxes will be printed as raster graphics or as device lines when box objects are not supported by the printer.

Access

Read/Write

Syntax

object.Boxes [= BtBoxPrintMethod]

The Boxes property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtBoxPrintMethod | Required. Any of the BtBoxPrintMethod constants. See below.

Settings

The BtBoxPrintMethod argument can be any of these settings:

Constant | Value | Description
btBoxRasterGraphics | 0 | Boxes will print as graphics.
btBoxDeviceLines | 1 | Boxes will print as device lines.
btBoxDeviceBox | 2 | Boxes will print as device boxes.
btBoxAuto | 3 | The printer driver will determine whether to print boxes as graphics, device lines, or device boxes.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Declaring the BarTender PrintMethod variable

Dim btPrintMethod As BarTender.Performance

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Setting the PrintMethod variable

btPrintMethod = btFormat.PrintMethod

'Setting the PrintMethod's boxes property

btPrintMethod.Boxes = BarTender.BtBoxPrintMethod.btBoxAuto

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Declaring the BarTender performance variable

BarTender.PrintMethod btPrintMethod;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Selecting the performance variable

btPrintMethod = btPrintSetup.PrintMethod;

//Setting the PrintMethod's boxes property

btPrintMethod.Boxes = BarTender.BtBoxPrintMethod.btBoxAuto;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PrintMethod Object


Lines Property

Description

Sets and returns whether lines will be printed as raster graphics or as device lines when line objects are not supported by the printer.

Access

Read/Write

Syntax

object.Lines[=BtLinePrintMethod]

The Lines property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtLinePrintMethod | Required. Any of the BtLinePrintMethod constants. See below.

Settings

The BtLinePrintMethod argument can be any of these settings:

Constant | Value | Description
btLineRasterGraphics | 0 | Lines will print as graphics.
btLineDeviceLines | 1 | Lines will print as device lines.
btLineAuto | 2 | The printer driver will determine whether to print lines as graphics or device lines.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Declaring the BarTender PrintMethod variable

Dim btPrintMethod As BarTender.Performance

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Setting the PrintMethod variable

btPrintMethod = btFormat.PrintMethod

'Setting the lines property

btPrintMethod.Lines = BarTender.BtLinePrintMethod.btLineAuto

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Declaring the BarTender performance variable

BarTender.PrintMethod btPrintMethod;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Selecting the performance variable

btPrintMethod = btPrintSetup.PrintMethod;

//Setting the lines property

btPrintMethod.Lines = BarTender.BtLinePrintMethod.btLineAuto;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PrintMethod


Ellipses Property

Description

Sets and returns whether ellipses will be printed as raster graphics or as device lines when ellipse objects are not supported by the printer.

Access

Read/Write

Syntax

object.Ellipses [= BtEllipsePrintMethod]

The Ellipses property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtEllipsePrintMethod | Required. Any of the BtEllipsePrintMethod constants. See below.

Settings

The BtEllipsePrintMethod argument can be any of these settings:

Constant | Value | Description
btEllipseRasterGraphics | 0 | Ellipses will print as graphics.
btEllipseDeviceLines | 1 | Ellipses will print as device lines.
btEllipseAuto | 2 | The printer driver will determine whether to print ellipses as graphics or device lines.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Declaring the BarTender PrintMethod variable

Dim btPrintMethod As BarTender.Performance

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Setting the PrintMethod variable

btPrintMethod = btFormat.PrintMethod

'Setting the PrintMethod's ellipse property

btPrintMethod.Ellipses = BarTender.BtEllipsePrintMethod.btEllipseAuto

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Declaring the BarTender performance variable

BarTender.PrintMethod btPrintMethod;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Selecting the performance variable

btPrintMethod = btPrintSetup.PrintMethod;

//Setting the PrintMethod's ellipse property

btPrintMethod.Ellipse = BarTender.BtEllipsePrintMethod.btEllipseAuto;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PrintMethod Object


TrueTypeText Property

Description

Sets and returns whether TrueType fonts will be treated as raster graphics or as text.

Access

Read/Write

Syntax

object.TrueTypeText[=BtTextPrintMethod]

The TrueTypeText property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtTextPrintMethod | Required. Any of the BtTextPrintMethod constants. See below.

Settings

The BtTextPrintMethod argument can be any of these settings:

Constant | Value | Description
btTextRasterGraphics | 0 | TrueType text treated as graphics.
btTextOutput | 1 | TrueType text treated as plain text.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Declaring the BarTender PrintMethod variable

Dim btPrintMethod As BarTender.Performance

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Setting the PrintMethod variable

btPrintMethod = btFormat.PrintMethod

'Setting the true type text property

btPrintMethod.TrueTypeText = BarTender.BtTextPrintMethod.btTextRasterGraphics

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Declaring the BarTender performance variable

BarTender.PrintMethod btPrintMethod;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Selecting the performance variable

btPrintMethod = btPrintSetup.PrintMethod;

//Setting the true type text property

btPrintMethod.TrueTypeText = BarTender.BtTextPrintMethod.btTextRasterGraphics;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PrintMethod


Unsupported1DBarCodes Property

Description

Sets and returns whether bar codes using one-dimensional symbologies unsupported by the printer will be printed as raster graphics or as device lines.

Access

Read/Write

Syntax

object.Unsupported1DBarCodes[=BtBarCodePrintMethod]

The Unsupported1DBarCodes property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtBarCodePrintMethod | Required. Must be one of the BtBarCodePrintMethod constants. See below.

Settings

The BtBarCodePrintMethod argument can be any of these settings:

Constant | Value | Description
btBarCodeRasterGraphics | 0 | Unsupported bar code symbologies will print as graphics.
btBarCodeDeviceLines | 1 | Unsupported bar code symbologies will print as device lines.
btBarCodeAuto | 2 | The printer driver will determine whether to print unsupported symbologies as graphics or device lines.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Declaring the BarTender PrintMethod variable

Dim btPrintMethod As BarTender.Performance

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Setting the PrintMethod variable

btPrintMethod = btFormat.PrintMethod

'Setting the 1D barcode property

btPrintMethod.Unsupported1DBarCodes = BarTender.BtBarCodePrintMethod.btBarCodeDeviceLines

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Declaring the BarTender performance variable

BarTender.PrintMethod btPrintMethod;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Selecting the performance variable

btPrintMethod = btPrintSetup.PrintMethod;

//Setting the 1D barcode property

btPrintMethod.Unsupported1DBarCodes = BarTender.BtBarCodePrintMethod.btBarCodeDeviceLines;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PrintMethod

SEE ALSO:

Unsupported2DBarCodes Property


Unsupported2DBarCodes Property

Description

Sets and returns whether bar codes using two-dimensional symbologies unsupported by the printer will be printed as raster graphics or as device lines.

Access

Read/Write

Syntax

object.Unsupported2DBarCodes[=BtBarCodePrintMethod]

The Unsupported2DBarCodes property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtBarCodePrintMethod | Required. Must be one of the BtBarCodePrintMethod constants. See below.

Settings

The BtBarCodePrintMethod argument can be any of these settings:

Constant | Value | Description
btBarCodeRasterGraphics | 0 | Unsupported bar code symbologies will print as graphics.
btBarCodeDeviceLines | 1 | Unsupported bar code symbologies will print as device lines.
btBarCodeAuto | 2 | The printer driver will determine whether to print unsupported symbologies as graphics or device lines.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Declaring the BarTender PrintMethod variable

Dim btPrintMethod As BarTender.Performance

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Setting the PrintMethod variable

btPrintMethod = btFormat.PrintMethod

'Setting the 2D barcode property

btPrintMethod.Unsupported2DBarCodes = BarTender.BtBarCodePrintMethod.btBarCodeRasterGraphics

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Declaring the BarTender performance variable

BarTender.PrintMethod btPrintMethod;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Selecting the performance variable

btPrintMethod = btPrintSetup.PrintMethod;

//Setting the 2D barcode property

btPrintMethod.Unsupported2DBarCodes = BarTender.BtBarCodePrintMethod.btBarCodeRasterGraphics;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PrintMethod

SEE ALSO:

Unsupported1DBarCodes Property


PrintSetup Object

Description

The PrintSetup object represents the printer and the print job configuration.

Properties

The following properties are supported:

Property | Description
AutoPrintAgain | Sets and returns the option to automatically print again.
Cache | Returns a reference to the Cache object.
IdenticalCopiesOfLabel | Sets and returns the number of identical copies of the label.
LogPrintJob | Sets and returns the option to log the print job in the BarTender log file.
NumberSerializedLabels | Sets and returns the number of serialized labels to print.
Performance | Returns a reference to the Performance object.
Printer | Returns the name of the printer.
PrintMethod | Returns a reference to the PrintMethod object.
PrintToFile | Sets and returns the print-to-file option.
RefreshDatabases | Sets and returns the option to reload databases just before the job prints.
UseDatabase | Sets or returns the current setting of the label format option to use an attached database for printing.


Cache Property

Description

Returns a reference to the Cache object.

Access

Read Only

Syntax

object.Cache

The Cache property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Cache property returns a reference to the format's Cache object, which controls the flushing of the printer's memory cache.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Declaring the BarTender cache variable

Dim btCache As BarTender.Cache

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Setting the cache variable

btCache = btFormat.Cache

'Flushing the cache

btCache.Flush

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Declaring the BarTender cache variable

BarTender.Cache btCache;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Selecting the cache variable

btCache = btPrintSetup.Cache;

//Flushing the cache

btCache.Flush();

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PrintSetup Object


LogPrintJob Property

Description

Sets and returns whether the print job will be logged to the BarTender log file.

Access

Read/Write

Syntax

object.LogPrintJob[={true|false}]

The LogPrintJob property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Required. If true, the print job will be logged.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Setting the log print job property

btPrintSetup.LogPrintJob = True

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Setting the log print job property

btPrintSetup.LogPrintJob = true;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PrintSetup


RefreshDatabases Property

Description

Sets and returns the option to reload databases just before the job prints.

Access

Read/Write

Syntax

object.RefreshDatabases [=true|false]

The RefreshDatabases property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Required. If true, databases will be reloaded.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender print setup variable

Dim btPrintSetup As BarTender.PrintSetup

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the print setup variable

btPrintSetup = btFormat.PrintSetup

'Setting the refresh database property

btPrintSetup.RefreshDatabases = True

'Print out the label

btFormat.PrintOut(False,False)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender print setup variable

BarTender.PrintSetup btPringSetup;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the print setup variable

btPringSetup = btFormat.PrintSetup;

//Setting the refresh database property

btPrintSetup.RefreshDatabases = True;

//Print out the label

btFormat.PrintOut(false,false);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

PrintSetup


QueryPrompt Object

Description

The QueryPrompt object represents a database query prompt defined on a label format.

Properties

The following properties are supported:

Property | Description
DefaultReply | Sets and returns the default reply for a query prompt.
Name | Returns the query prompt name for a query prompt.
UserPrompt | Sets and returns the user prompt for a query prompt.
Value | Sets and returns the value for a query prompt.

SEE ALSO:

QueryPrompts Collection

Databases Collection

Automating Database Printing.


DefaultReply Property

Description

Sets and returns the default reply for a query prompt. This is the text that initially appears in the reply box on the prompt dialog when it opens.

Note: If the Value property is not null, then the prompt is suppressed and the DefaultReply text is replaced with the text from the Value property.

Access

Read/Write

Syntax

object.DefaultReply[=ReplyText]

The DefaultReply property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
ReplyText | Required. The default reply text to use for the query prompt.

Remarks

The DefaultReply property sets and returns the default reply for a query prompt. The default reply is the text that will be displayed in the edit box of the query prompt.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring the BarTender query prompt variable

Dim btQueryPrompt As BarTender.QueryPrompt

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the query prompt

btQueryPrompt = btFormat.Databases.QueryPrompts.GetQueryPrompt(1)

'Set the user prompt of the query prompt

btQueryPrompt.UserPrompt = "Enter Name of Employee:"

'Set the default reply of the query prompt

btQueryPrompt.DefaultReply = "employee name"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender query prompt variable

BarTender.QueryPrompt btQueryPrompt;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the query prompt

btQueryPrompt = btFormat.Databases.QueryPrompts.GetQueryPrompt(1);

//Set the user prompt of the query prompt

btQueryPrompt.UserPrompt = "Enter Name of Employee:";

//Set the default reply of the query prompt

btQueryPrompt.DefaultReply = "employee name";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

QueryPrompt

SEE ALSO:

QueryPrompts Collection

Automating Database Printing.


Name Property (Query)

Name Property (Query Prompt)

Description

Returns the name for a query prompt.

Access

Read Only

Syntax

object.Name

The Name property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Name property returns the name for a query prompt.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring the BarTender query prompt variable

Dim btQueryPrompt As BarTender.QueryPrompt

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the query prompt

btQueryPrompt = btFormat.Databases.QueryPrompts.GetQueryPrompt(1)

'Show the query prompt's name

MessageBox.Show(btQueryPrompt.Name)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender query prompt variable

BarTender.QueryPrompt btQueryPrompt;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the query prompt

btQueryPrompt = btFormat.Databases.QueryPrompts.GetQueryPrompt(1);

//Show the query prompt's name

MessageBox.Show(btQueryPrompt.Name);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

QueryPrompt

SEE ALSO:

QueryPrompts Collection

Automating Database Printing


UserPrompt Property

Description

Sets and returns the text of the prompt for a query prompt.

Access

Read/Write

Syntax

object.UserPrompt[=UserPromptText]

The UserPrompt property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
UserPromptText | Required. The user prompt text to use for the query prompt.

Remarks

The UserPrompt property sets and returns the user prompt text for a query prompt.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring the BarTender query prompt variable

Dim btQueryPrompt As BarTender.QueryPrompt

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the query prompt

btQueryPrompt = btFormat.Databases.QueryPrompts.GetQueryPrompt(1)

'Set the user prompt of the query prompt

btQueryPrompt.UserPrompt = "Enter Name of Employee:"

'Set the default reply of the query prompt

btQueryPrompt.DefaultReply = "employee name"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender query prompt variable

BarTender.QueryPrompt btQueryPrompt;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the query prompt

btQueryPrompt = btFormat.Databases.QueryPrompts.GetQueryPrompt(1);

//Set the user prompt of the query prompt

btQueryPrompt.UserPrompt = "Enter Name of Employee:";

//Set the default reply of the query prompt

btQueryPrompt.DefaultReply = "employee name";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

QueryPrompt

SEE ALSO:

QueryPrompts Collection


Value Property (Query)

Value Property (QueryPrompt)

Description

Sets and returns the the text that should be used to respond automatically to a query prompt. (This text will replace the text in the DefaultReply property.) Unless the string is null, setting this property will prevent the query prompt from appearing.

Access

Read/Write

Syntax

object.Value[=ResponseText]

The Value property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
ResponseText | Required. The text automatically used to respond to the query prompt.

Remarks

The Value property sets and returns the text that will be used to automatically respond to the query prompt. If the Value property contains a string, then the query prompt will not be displayed for a data browse or print function. If the Value property is empty, then during a data browse or print function the query prompt will be displayed for the user to enter a response. (The response box on the prompt dialog will initially contain the value of the DefaultReply property.)

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring the BarTender query prompt variable

Dim btQueryPrompt As BarTender.QueryPrompt

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the query prompt

btQueryPrompt = btFormat.Databases.QueryPrompts.GetQueryPrompt(1)

'Setting the user prompt value

btQueryPrompt.Value = "Michael Berkley"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender query prompt variable

BarTender.QueryPrompt btQueryPrompt;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the query prompt

btQueryPrompt = btFormat.Databases.QueryPrompts.GetQueryPrompt(1);

//Setting the user prompt value

btQueryPrompt.Value = "Michael Berkley";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

QueryPrompt

SEE ALSO:

QueryPrompts Collection

Automating Database Printing.


GetQueryPrompt Method

Description

Returns a reference to a specified QueryPrompt object.

Syntax

object.GetQueryPrompt (Index)

The GetQueryPrompt method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Index | Required. Index of query prompt object to reference. Alternatively, use the query prompt's Name property as string.

Remarks

Use the GetQueryPrompt method to access a specific query prompt that is setup on a BarTender label format. Index can be either an integer value or a string index specifying the query prompt name.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender query prompt variable

Dim btQueryPrompt As BarTender.QueryPrompt

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the query prompt

btQueryPrompt = btFormat.Databases.QueryPrompts.GetQueryPrompt(1)

'Alternatively, use the query prompt's Name property if it is known

'btQueryPrompt = btFormat.Databases.QueryPrompts.GetQueryPrompt("Today's Date")

'Showing the query prompt's name

MessageBox.Show(btQueryPrompt.Name)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender query prompt variable

BarTender.Database btQueryPrompt;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the query prompt

btQueryPrompt = btFormat.Databases.QueryPrompts.GetQueryPrompt(1);

//Alternatively, use the query prompt's name if it is known

//btQueryPrompt = btFormat.Databases.QueryPrompts.GetQueryPrompt("Today's Date");

//Showing the query prompt's name

MessageBox.Show(btQueryPrompt.Name);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

QueryPrompts Collection Object

SEE ALSO:

QueryPrompt Object

Automating Database Printing.


Item Method (QueryPrompts)

Item Method (QueryPrompt)

Description

Returns a reference to a specified QueryPrompt object.

Note: This method has the same functionality as the GetQueryPrompt method.

Syntax

object.Item (Index)

The Item method has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Index | Required. Index of query prompt object to reference. Can be either an integer or string index.

Remarks

Use the Item method to access a specific query prompt that is setup on a BarTender label format. Index can be either an integer value or a string index specifying the query prompt name. In VB.NET Item is the default method for the QueryPrompts collection, therefore the Item method does not have to be specified in order to get a reference to a given QueryPrompt object. The QueryPrompt object can be referenced directly using the QueryPrompts collection.

Applies To

QueryPrompts Collection Object

SEE ALSO:

QueryPrompt Object

Automating Database Printing.


Count Property (Query Prompts)

Description

Returns the number of query prompts.

Access

Read Only

Syntax

object.Count

The Count property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Count property returns the number of query prompts currently setup for a BarTender label format.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Show total number of query prompts

MessageBox.Show(btFormat.QueryPrompts.Count.ToString)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Show the number of query prompts

MessageBox.Show(btFormat.QueryPrompts.Count.ToString());

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

QueryPrompts Collection Object

SEE ALSO:

QueryPrompt Object

Automating Database Printing.


SAPIDoc Object

Description

The SAPIDoc object represents a SAP IDoc Data Source database.

Properties

The following properties are supported.

Property | Description
IDocFileName | Sets and returns the IDoc filename.

SEE ALSO:

Automating database printing

Databases Collection Object

Database Object

ODBC Object

TextFile


IDocFileName Property

Description

Sets and returns the IDoc filename.

Access

Read/Write

Syntax

object.IDocFileName [=Path&FileName]

The IDocFileName property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Path&FileName | Required when writing. The path and name of the IDoc file to use.

Remarks

The IDocFileName property sets and returns the name of the IDoc file to use.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Setting the IDoc file name

btDb.SAPIDoc.IDocFileName = "c:\IDD-LIEF03_00108226.ORDERS03_46C"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Setting the IDoc file name

btDb.SAPIDoc.IDocFileName = "c:\IDD-LIEF03_00108226.ORDERS03_46C";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

SAPIDoc Object

SEE ALSO:

Databases Collection Object

Automating database printing


SubString Object

Description

The SubString object represents a substring that is assigned to an object on the label format.

Properties

The following properties are supported:

Property | Description
Name Property | Returns the substring name.
Type | Returns the substring type.
Value | Sets and returns the value for a SubString.

SEE ALSO:

Changing Text and Bar Code Data On The Label

GetNamedSubStringValue Method

NamedSubStrings Collection Object

SetNamedSubStringValue Method


Name Property (SubString)

Description

Returns the substring name.

Access

Read Only

Syntax

object.Name

The Name property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Name property returns the name for a substring.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring the BarTender substring variable

Dim btSubString As BarTender.SubString

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the substring

btSubString = btFormat.NamedSubStrings.GetSubString(1)

'Show the substring's name

MessageBox.Show(btSubString.Name)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.SubString btSubString ;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the substring

btSubString = btFormat.NamedSubStrings.GetSubString(1);

//Show the substring's name

MessageBox.Show(btSubString.Name);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

SubString

SEE ALSO:

NamedSubStrings Collection Object

SetNamedSubStringValue Method

GetNamedSubStringValue Method

Changing Text and Bar Code Data On The Label


Type Property (SubString)

Description

Returns the type of data source that the substring is using.

Access

Read Only

Syntax

object.Type

The Type property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Settings

The Type can have any of the BtSubStringType constants:

Constant | Value | Description
btSubStringScreenData | 0 | The substring type is a Screen Data Source.
btSubStringDate | 1 | The substring type is a Date source.
btSubStringTime | 2 | The substring type is a Time source.
btSubStringVBScript | 3 | The substring type is a VB Script source.
btSubStringDatabase | 4 | The substring type is a Database source

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender substring variable

Dim btSubString As BarTender.SubString

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the named substring

btSubString = btFormat.NamedSubStrings.GetSubString(1)

'Getting the substring type

MessageBox.Show(btSubString.Type.ToString)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender substring variable

BarTender.SubString btSubString;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the named substring

btSubString = btFormat.NamedSubStrings.GetSubString(1);

//Getting the substring type

MessageBox.Show(btSubString.Type.ToString());

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

SubString

SEE ALSO:

NamedSubStrings Collection Object

SetNamedSubStringValue Method

GetNamedSubStringValue Method

Changing Text and Bar Code Data On The Label


Value Property (SubString)

Description

Sets and returns the value for a substring.

Access

Read/Write

Syntax

object.Value[=newValue]

The Value property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
newValue | Optional in VB, otherwise required. The value text used for the substring.

Remarks

The Value property sets and returns the substring value. You can only modify a substring with a Screen Data data source.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring the BarTender substring variable

Dim btSubString As BarTender.SubString

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the substring

btSubString = btFormat.NamedSubStrings.GetSubString(1)

'Setting the sub-string value

btSubString.Value = "123 Street"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.SubString btSubString ;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the substring

btSubString = btFormat.NamedSubStrings.GetSubString(1);

//Setting the sub-string value

btSubString.Value = "123 Street";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

SubString

SEE ALSO:

NamedSubStrings Collection Object

SetNamedSubStringValue Method

GetNamedSubStringValue Method

Changing Text and Bar Code Data On The Label


TextFile Object

Description

The TextFile object represents a text file database.

Properties

The following properties are supported:

Property | Description
Delimitation | Sets and returns the field delimitation type for a database text file.
FieldDelimiter Property | Sets and returns the field delimiter for a text file when the Delimitation property is set to btDelimCustom.
FileName | Sets and returns the database text file name.
NumberOfFields | Sets and returns the number of fields to scan per record in a text file.
UseFieldNamesFromFirstRecord | Sets and returns whether or not to use field names from the first record of a text file.

SEE ALSO:

Automating Database Printing

Databases Collection Object

Database Object

ODBC Object

OLE DB Object


Delimitation Property

Description

Sets and returns the method of field delimitation for a database text file.

Access

Read/Write

Syntax

object.Delimitation [=BtTextFileDelimitation]

The Delimitation property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtTextFileDelimitation | Required. Any of the BtTextFileDelimitation constants. See below.

Settings

The BtTextFileDelimitation argument can have one of the following settings:

Constant | Value | Description
btDelimMixedQuoteAndComma | 0 | The text file is mixed quote and command delimited.
btDelimQuoteAndComma | 1 | The text file is quote and comma delimited.
btDelimComma | 2 | The text file is comma delimited.
btDelimTab | 3 | The text file is tab delimited.
btDelimCustom | 4 | The text file is delimited by the FieldDelimiter property.

Remarks

The Delimitation property sets and returns the method of delimitation for a text file. You can use comma, mixed quote and comma, quote and comma, tab, and custom delimited text files.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Setting the delimiter to custom

btDb.TextFile.Delimitation = BarTender.BtTextFileDelimitation.btDelimCustom

'Setting the custom delimiter

btDb.TextFile.FieldDelimiter = ";"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Setting the delimiter to custom

btDb.TextFile.Delimitation = BarTender.BtTextFileDelimitation.btDelimCustom;

//Setting the custom delimiter

btDb.TextFile.FieldDelimiter = ";";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

TextFile Object

SEE ALSO:

FieldDelimiter Property

Database Object

Databases Collection Object

ODBC Object

Automating database printing.


FieldDelimiter Property

Description

Sets and returns the field delimiter for a text file when the Delimitation property is set to btDelimCustom.

Access

Read/Write

Syntax

object.FieldDelimiter [=DelimitingCharacter]

The FieldDelimiter property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
DelimitingCharacter | Required. A valid ASCII character. Any extra characters will be ignored.

Remarks

Sets and returns the field delimiter for a text file when the Delimitation property is set to btDelimCustom. The value of this property will be ignored if Delimitation is set to any other value.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Setting the delimiter to custom

btDb.TextFile.Delimitation = BarTender.BtTextFileDelimitation.btDelimCustom

'Setting the custom delimiter

btDb.TextFile.FieldDelimiter = ";"

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Setting the delimiter to custom

btDb.TextFile.Delimitation = BarTender.BtTextFileDelimitation.btDelimCustom;

//Setting the custom delimiter

btDb.TextFile.FieldDelimiter = ";";

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

TextFile Object

SEE ALSO:

Delimitation Property

Database Object

Databases Collection Object

Automating Database Printing.


FileName Property (TextFile Database)

Description

Sets and returns the path and file name of the text database.

Access

Read/Write

Syntax

object.FileName [=TextFilePath&Name]

The FileName property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
TextFilePath&Name | Optional in VB, otherwise required. The path and name of the text file to use.

Remarks

The FileName property sets and returns the path and name of the text file to use for the text file database.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Displaying the database file name

MessageBox.Show(btDb.TextFile.FileName)

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Displaying the database file name

MessageBox.Show(btDb.TextFile.FileName);

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

TextFile Object

SEE ALSO:

Database Object

Databases Collection Object

Automating Database Printing.


NumberOfFields Property

Description

Sets and returns the number of fields to scan from each record in a text file database.

Access

Read/Write

Syntax

object.NumberOfFields [=Value]

The NumberOfFields property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Value | Required. Number of fields to read.

Remarks

The NumberOfFields sets and returns the number of fields to scan per record in a text file. Setting NumberOfFields is useful when the number of fields is known prior to reading the database, and there is no point in reading past the last field that will be used.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Setting the number of fields

btDb.TextFile.NumberOfFields = 4

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Setting the number of fields

btDb.TextFile.NumberOfFields = 4;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

TextFile

SEE ALSO:

Database Object

Databases Collection Object

ODBC Object

OLEDB Object

Automating Database Printing


UseFieldNamesFromFirstRecord Property

Description

Sets and returns whether or not to use field names from the first record of a text file.

Access

Read/Write

Syntax

object.UseFieldNamesFromFirstRecord[=1|0]

The UseFieldNamesFromFirstRecord property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
1|0 | Required. If 1, then use field names from first record.

Remarks

The UseFieldNamesFromFirstRecord property sets and returns whether or not to use field names from the first record of a text file. The first record (or row) can contain header information for each of the field columns. By setting UseFieldNamesFromFirstRecord to 1, BarTender will read the first record and assign field names based on the values read. All remaining records will be read as data to be printed on the label.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring the BarTender database variable

Dim btDb As BarTender.Database

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Selecting the database

btDb = btFormat.Databases.GetDatabase(1)

'Setting the to use field names from first record

btDb.TextFile.UseFieldNamesFromFirstRecord = 1

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring the BarTender database variable

BarTender.Database btDb;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Selecting the database

btDb = btFormat.Databases.GetDatabase(1);

//Setting the to use field names from first record

btDb.TextFile.UseFieldNamesFromFirstRecord = 1;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

TextFile

SEE ALSO:

Database Object

Databases Collection Object

ODBC Object

Automating database printing.


Verification Object

Description

The Verification object represents a problem that occurred when an attempt was made to export a printer code template. The Verification object is only valid if its parent Message object's Type property is set to btMsgTypeVerification.

Properties

The following properties are supported:

Property | Description
Problem | Returns a description of the issue.
Fields | Returns the names of the printer code template fields, if any, that are causing the problem.
Result | Returns a description of what happened because of the problem.
AutoFix | Returns a description of how AutoFix would fix the problem.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender verification variable

Dim btVerification As BarTender.Verification

'Declaring a BarTender messages variable to hold all messages

Dim btMessages As BarTender.Messages

'Declaring a BarTender message variable to hold individual messages

Dim btMessage As BarTender.Message

'Declaring a variable for holding message text

Dim btMessageText As String

'Declaring a success variable

Dim ExportSuccess As Boolean

'Declaring loop counter

Dim i As Integer

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Exporting the printer code template

ExportSuccess = btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Checking to see if there is an error message

If ExportSuccess = False Then

'Looping through the messages

For i = 1 To btMessages.Count

'Getting the error message

btVerification = btMessages.GetMessage(1).Verification

'Populating error messages into a string

btMessageText = btMessageText & btVerification.Problem & vbCrLf & btVerification.Fields & _
" " & btVerification.AutoFix & vbCrLf & btVerification.Result

Next i

'Display the problem with exporting the printer code

MessageBox.Show("Export Failed. Errors and Warnings: " & btMessageText)

Else

'Looping through the messages

For Each btMessage In btMessages

'Getting the error message

btVerification = btMessages.GetMessage(1).Verification

'Populating warning messages into a string

btMessageText = btMessageText & btVerification.Problem & vbCrLf & btVerification.Fields & _
" " & btVerification.AutoFix & vbCrLf & btVerification.Result

Next

'Display the problem with exporting the printer code

MessageBox.Show("Export Failed. Errors and Warnings: " & btMessageText)

End If

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender verification variable

BarTender.Verification btVerification;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring a variable for holding message text

string btMessageText = "";

//Declaring a success variable

bool ExportSuccess;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Exporting the printer code template

ExportSuccess = btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate,
"c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn",
ref obj);

//Setting the message variable to the object

btMessages = obj as BarTender.Messages;

//Checking to see if there is an error message

if (ExportSuccess == false)

{

//Looping through the messages

for (int i = 1; i <= btMessages.Count; i++)

{

//Getting the error message

btVerification = btMessages.GetMessage(1).Verification;

//Populating error messages into a string

btMessageText = btMessageText + btVerification.Problem + "\r\n" + btVerification.Fields +
" " + btVerification.AutoFix + "\r\n" + btVerification.Result;

}

//Display the problem with exporting the printer code

MessageBox.Show("Export failed. Errors and Warnings: " + btMessageText);

}

else

{

//Looping through the messages

foreach (BarTender.Message btMessage in btMessages)

{

//Getting the error message

btVerification = btMessages.GetMessage(1).Verification;

//Populating error messages into a string

btMessageText = btMessageText + btVerification.Problem + "\r\n" + btVerification.Fields +
" " + btVerification.AutoFix + "\r\n" + btVerification.Result;

}

//Display the problem with exporting the printer code

MessageBox.Show("Export succeeded. Warnings: " + btMessageText);

}

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);


AutoFix Property

Description

Returns a description of what BarTender's AutoFix feature will do to resolve the problem described in the Verification object's Problem property. For example, if the problem is that a field uses a TrueType font, the AutoFix property will report that AutoFix would change the font to a printer-based font.

Access

Read Only

Syntax

object.AutoFix

The AutoFix property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

Returns a description of what BarTender's AutoFix feature will do to resolve the problem described in the Verification object's Problem property.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender verification variable

Dim btVerification As BarTender.Verification

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Checking to see if there is an error message

If btMessages.Count > 0 then

'Getting the error message text

btVerification = btMessages.GetMessage(1).Verification

'Display the auto fix for the problem

MessageBox.Show(btVerification.AutoFix)

End If

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender verification variable

BarTender.Verification btVerification ;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, "c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the message variable to the object

btMessages = obj as BarTender.Messages;

if (btMessages.Count > 0)

{

//Getting the error message

btVerification = btMessages.GetMessage(1).Verification;

//Display the auto fix for the problem

MessageBox.Show(btVerification.AutoFix);

}

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Verification Object


Fields Property

Description

Returns the names of the Printer Code Template fields that are causing the message.

Access

Read Only

Syntax

object.Fields

The Fields property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Fields property returns the names of the Printer Code Template fields, if any, that are causing the message.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender verification variable

Dim btVerification As BarTender.Verification

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Checking to see if there is an error message

If btMessages.Count > 0 then

'Getting the error message text

btVerification = btMessages.GetMessage(1).Verification

'Display the field that has a problem

MessageBox.Show(btVerification.Fields)

End If

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender verification variable

BarTender.Verification btVerification ;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, "c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the message variable to the object

btMessages = obj as BarTender.Messages;

if (btMessages.Count > 0)

{

//Getting the error message

btVerification = btMessages.GetMessage(1).Verification;

//Display the field that has a problem

MessageBox.Show(btVerification.Fields);

}

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Verification Object


Problem Property

Description

Returns a detailed description of the contents of a message.

Access

Read Only

Syntax

object.Problem

The Problem property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Verification object's Problem property returns a more detailed version of the message than is found in the Message object Text property.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender verification variable

Dim btVerification As BarTender.Verification

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Checking to see if there is an error message

If btMessages.Count > 0 then

'Getting the error message text

btVerification = btMessages.GetMessage(1).Verification

'Display the problem

MessageBox.Show(btVerification.Problem)

End If

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender verification variable

BarTender.Verification btVerification ;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, "c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the message variable to the object

btMessages = obj as BarTender.Messages;

if (btMessages.Count > 0)

{

//Getting the error message

btVerification = btMessages.GetMessage(1).Verification;

//Display the problem

MessageBox.Show(btVerification.Problem);

}

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Verification Object


Results Property

Description

Returns a description of what happened when the attempt to export the template was made.

Access

Read Only

Syntax

object.Results

The Results property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Results property returns a description of what happened because of the problem described in the Problem property of the Verification object.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Declaring a BarTender printer code template variable

Dim btPrinterCodeTemplate As BarTender.PrinterCodeTemplate

'Declaring a BarTender verification variable

Dim btVerification As BarTender.Verification

'Declaring a BarTender messages variable

Dim btMessages As BarTender.Messages

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate

'Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, _
"c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Checking to see if there is an error message

If btMessages.Count > 0 then

'Getting the error message text

btVerification = btMessages.GetMessage(1).Verification

'Display the results of the attempted export

MessageBox.Show(btVerification.Results)

End If

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring the BarTender format variable

BarTender.Format btFormat;

//Declaring a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPrinterCodeTemplate;

//Declaring a BarTender verification variable

BarTender.Verification btVerification;

//Declaring a BarTender messages variable

BarTender.Messages btMessages;

//Declaring an object variable

System.Object obj = null;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

//Setting the printer code template variable

btPrinterCodeTemplate = btFormat.PrinterCodeTemplate;

//Exporting the printer code template

btPrinterCodeTemplate.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, "c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

//Setting the message variable to the object

btMessages = obj as BarTender.Messages;

if (btMessages.Count > 0)

{

//Getting the error message

btVerification = btMessages.GetMessage(1).Verification;

//Display the results of the export

MessageBox.Show(btVerification.Results);

}

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Verification


Window Object

Description

The Window object represents the appearance of BarTender application.

User Interface Representation: BarTender Application Window.

See also, Using the Window Object.

Properties

The following properties are supported:

Property | Description
Height | Sets and returns the height of the window.
Left | Sets and returns the left coordinate of the window.
Top | Sets and returns the top coordinate of the window.
Width | Sets and returns the width of the window.
WindowState | Sets and returns the state of the window.


Height Property

Description

Sets and returns the height of the window in pixels.

Access

Read/Write

Syntax

object.Height [=Value]

The Height property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Value | Required. The height of the window in pixels

Remarks

Changes to the Width property are independent of the Left property (the y-coordinate of the window) and the Top property (the x-coordinate of the window).

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the height property

btApp.Window.Height = 250

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the height property

btApp.Window.WindowState = btApp.Window.Height = 250;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Window

SEE ALSO:

Using the Window Object

Top Property

Left Property

Width Property


Left Property

Description

Sets and returns the distance, in pixels, of the left edge of the window from the left edge of the screen.

Access

Read/Write

Syntax

object.Left [=Value]

The Left property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Value | Required. The X-coordinate of the window in pixels.

Remarks

Setting this property does not affect the width or height of the window.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the left property

btApp.Window.Left = 250

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the left property

btApp.Window.WindowState = btApp.Window.Left = 250;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Window

SEE ALSO:

Using the Window Object

Top Property

Height Property

Width Property


Top Property

Description

Sets and returns the distance, in pixels, of the top edige of the window from the top edge of the screen.

Access

Read/Write

Syntax

object.Top[=Value]

The Top property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Value | Required. The Y-coordinate of the window’s top edge in pixels.

Remarks

Setting this property does not affect the width or height of the window.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the top property

btApp.Window.Top = 250

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the top property

btApp.Window.WindowState = btApp.Window.Top = 250;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Window

SEE ALSO:

Using the Window Object

Left Property

Height Property

Width Property


Width Property

Description

Sets and returns the width of the window in pixels.

Access

Read/Write

Syntax

object.Width[=Value]

The Width property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Value | Required. The width of the window in pixels

Remarks

Changes to the Width property are independent of the Left property (the y-coordinate of the window) and the Top property (the x-coordinate of the window).

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the width property

btApp.Window.Width = 250

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the width property

btApp.Window.WindowState = btApp.Window.Width = 250;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Window

SEE ALSO:

Using the Window Object

Top Property

Left Property

Height Property


WindowState Property

Description

Sets and returns the state of the window.

Access

Read/Write

Syntax

object.WindowState[=BtWindowState]

The WindowState property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtWindowState | Required. Any of the BtWindowState constants. See below.

Settings

The BtWindowState argument can have any of the following settings:

Constant | Value | Description
BtNormal | 0 | Shows the window in its normal state.
BtMaximize | 1 | Maximizes the window.
BtMinimize | 2 | Minimizes the window.

Remarks

Use the WindowState property to maximize and minimize the window.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the window state property

btApp.Window.WindowState = BarTender.BtWindowState.btMaximize

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the window state property

btApp.Window.WindowState = BarTender.BtWindowState.btMaximize;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Window

SEE ALSO:

Using the Window Object


InputDataFileSetup Object

InputDataFileSetup Object (Obsolete)

The InputDatafileSetup object represents the Input Data File Setup dialog and its options.

Note: This property is obsolete as of version 6.0. It is supported only for backward compatibility. Use the Databases Collection.

The following properties are supported.

Property | Description
AutoViewSelectedRecords | Sets and returns the status of the Automatically View Selected Records Before Printing option.
ODBC Object | The ODBC object represents an ODBC Data Source database.
TextFile | The TextFile object represents a text file database.
Type | Returns the type of database to use.

SEE ALSO:

Using the Format Object

Changing the Input Data File


AutoViewSelectedRecords Property

AutoViewSelectedRecords Property (Obsolete)

Description

Sets and returns the status of the Automatically View Selected Records Before Printing option.

Note: This property is obsolete as of version 6.0.

Access

Read/Write

Syntax

object.AutoViewSelectedRecords [=true|false]

The AutoViewSelectedRecords property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Required. If true, will display the View Selected Records window when printing.

Remarks

If set true, the View Selected Records window will be displayed.

Applies To

InputDataFileSetup

SEE ALSO:

Automating Database Printing

Changing the Input Data File

Input Data File


Type Property (InputDataFileSetup)

Type Property (of InputDataFileSetup Object)

Description

Sets and returns the type of data file to use.

Access

Read/Write

Syntax

object.Type[=BtInputDataFile]

The Type property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
BtInputDataFile | Optional in VB, otherwise required. Any of the BtInputDataFile constants. See below.

Settings

The BtInputDataFile argument can have either of the following settings:

Constant | Value | Description
btODBC | 1 | Reserved for future use. Will be ignored.
btTextFile | 0 | Sets the input data file type to read text files.

Remarks

The Type property sets and returns the type of data file to use.

Note: The InputDataFileSetup object is obsolete as of version 6.0. It is supported only for backward compatibility. Use the Databases Collection.

Applies To

InputDataFileSetup

SEE ALSO:

Changing the Input Data File

Input Data File


Formats Property

Description

Returns a reference to the Formats collection object: all the label formats currently open in the BarTender application.

Access

Read Only

Syntax

object.Formats

The Formats property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Formats property returns a reference to the Formats collection. The Formats collection manages the list of open formats in BarTender.

VB.NET Example

'Declaring a BarTender application variable

Dim btApp as BarTender.Application

'Declaring a BarTender format variable

Dim btFormat as New BarTender.Format

'Instantiating the BarTender object

btApp = new BarTender.ApplicationClass

'Setting the BarTender Application Visible

btApp.Visible = True

'Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

C# Example

//Declaring a BarTender application variable

BarTender.Application btApp;

//Declaring a BarTender format variable

BarTender.Format btFormat;

//Instantiating the BarTender object

btApp = new BarTender.ApplicationClass();

//Setting the BarTender Application Visible

btApp.Visible = true;

//Setting the BarTender format to open

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "") ;

//Ending the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Applies To

Application


UseInputDataFile Property

UseInputDataFile Property (Obsolete)

Description

Sets and returns the Use Input Data File option.

Access

Read/Write

Syntax

object.UseInputDataFile [=true|false]

The UseInputDataFile property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
true|false | Required. If true, then use an input data file during printing.

Remarks

The UseInputDataFile sets and returns whether or not to use an input data file during printing.

Note: This property is obsolete as of version 6.0. It is supported only for backward compatibility. Use the Databases Collection.

Applies To

Format

SEE ALSO:

Using the Format Object


ActiveX Automation Alphabetic Keyword List

The following is an alphabetic list of available properties, methods, and objects when using BarTender’s ActiveX Automation interface within another application.

Action Property

Activate Method

Add Method

ActiveFormat Property

Add Method

Address Property

AllowFormatCaching Property

AllowGraphicsCaching Property

AllowSerialization Property

AllowStaticGraphics Property

AllowStaticObjects Property

AllowVariableDataOptimization Property

AlternateAddress Property

AlternatePort Property

AlternateTimeout Property

Application Object

AutoFix Property

AutoPrintAgain Property

BaseName Property

Boxes Property

BuildNumber Property

Cache Property

Cache Object

Close Method

Connect Method

Count Property (Databases)

Count Property (Formats)

Count Property (Messages)

Count Property (NamedSubStrings)

Count Property (QueryPrompts)

Databases Collection Object

Database Object

DataItemName Property

DataItemType Property

DefaultReply Property

Delimitation Property

Directory Property

EnablePrompting

Export Method

ExportAsVersion Property

ExportToClipboard Method

ExportToFile Method

FieldDelimiter Property

Fields Property

FileName Property (for Text File Databases)

FileName Property (for Label Formats)

Flush Method

FlushInterval Property

Format Object

FormatIDType Property

FormatID Property

Formats Collection Object

Formats Property

GetAll Method

GetFormat Method

GetDatabase Method

GetMessage Method

GetNamedSubStringValue Method

GetQueryPrompt Method

GetSubString Method

Height Property

IdenticalCopiesOfLabel Property

IdocFileName Property

IgnoreCase Property

Inverse Property

IsConnected Property

IsPrinting Property

IsProcessingCommandLines Property

Item Method (Databases)

Item Method (Formats)

Item Method (Messages)

Item Method (NamedSubstrings)

Item Method (Query Prompts)

Job Property

Job Object

LabelColumns Property

LabelCorners Property

LabelGapHorizontal

LabelGapManual

LabelGapVertical

LabelHeight Property

LabelHole Property

LabelHoleDiameter Property

LabelRows Property

LabelShape Property

LabelSizeManual Property

LabelWidth Property

Left Property

LicenseServer Object

LicenseServer Property

Lines Property

LogPrintJob Property

MarginBottom Property

MarginLeft Property

MarginRight Property

MarginTop Property

MediaHandling Property

Messages Collection Object

Message Object

Message Property of Message Object

Mirror Property

Name Property (Database)

Name Property (QueryPrompt)

Name Property (Substring)

Number Property

NamedSubStrings Object Collection

NumberLabels Property

NumberOfFields Property

NumberSerializedLabels Property

Occurrence Property

ODBC Object

ODBC Property

OLEDB Object

OLEDB Property

Open Method

Orientation Property

PageSetup Object

PageSetup Property

PaperHeight Property

PaperID Property

PaperName Property

PaperWidth Property

Password Property (ODBC)

Password Property (OLE DB)

Performance Object

Performance Property

Port Property

Printer Property

PrinterCodeTemplate Object

PrinterCodeTemplate Property

PrintMethod Object

PrintMethod Property

PrinterBatchCopiesType Property

PrinterBatchCopies Property

PrinterCopiesType Property

PrinterCopies Property

PrinterSerializedCopiesType Property

PrinterSerializedCopies Property

PrinterFile Property

PrintOut Method

PrintSetup Object

PrintSetup Property

PrintToFile Property

Problem Property

QueryPrompts Collection Object

QueryPrompt Object

Quit Method

RecordRange

RefreshDatabases Property

Results Property

SAPIDocDefinitionFile Property

SAPIDoc Object

SAPIDoc Property

Save Method (Application)

Save Method (Format)

SaveAs Method

SaveAsVersion Property

SelectRecordsAtPrint

SetNamedSubStringValue Method

SetAll Method

SetStock Method

Severity Property

SQLStatement Property (ODBC)

SQLStatement Property (OLE DB)

StockCategory Property

StockType Property

SubString Object

TextFile Object

TextFile Property

Timeout Property

Title Property

Top Property

Tray Property

TrueTypeText Property

Type Property (Database)

Type Property (Message)

Type Property (Substring)

Unsupported1DBarCodes Property

Unsupported2DBarCodes Property

UseDatabase Property

UseFieldNamesFromFirstRecord Property

UseInputDataFile Property

UserId Property (ODBC)

UserId Property (OLE DB)

UserPrompt Property

Valid Property

Value Property (QueryPrompt)

Value Property (Substring)

Verification Object

Verification Property

Version Property

Visible Property

WarnWhenUsingTrueTypeFonts Property

Width Property

Window Object

WindowState Property

SEE ALSO:

ActiveX Automation Properties List

ActiveX Automation Methods List

Object Model


ActiveX Automation Methods List

The following is an alphabetic list of available methods when using BarTender’s ActiveX Automation interface within another application.

Activate Method

Add Method

Close Method

Connect Method

Export Method

ExportToClipboard Method

ExportToFile Method

Flush Method

GetAll Method

GetFormat Method

GetDatabase Method

GetMessage Method

GetNamedSubStringValue Method

GetQueryPrompt Method

GetSubString Method

Item Method (Databases)

Item Method (Formats)

Item Method (Messages)

Item Method (QueryPrompts)

Item Method (SubStrings)

Open Method

PrintOut Method

Quit Method

Save Method (Application)

Save Method (Format)

SaveAs Method

SetNamedSubStringValue Method

SetStock Method

SEE ALSO:

ActiveX Automation Alphabetic Keyword List

ActiveX Automation Properties List

ActiveX Automation Objects List


ActiveX Automation Properties List

The following is an alphabetic list of available properties when using BarTender’s ActiveX Automation interface within another application.

ActiveFormat Property

Action Property

Address Property

AllowFormatCaching Property

AllowGraphicsCaching Property

AllowSerialization Property

AllowStaticGraphics Property

AllowStaticObjects Property

AllowVariableDataOptimization Property

AlternateAddress Property

AlternatePort Property

AlternateTimeout Property

AutoFix Property

AutoPrintAgain Property

BaseName Property

Boxes Property

BuildNumber Property

Cache Property

Count Property (Database)

Count Property (Formats)

Count Property (Messages)

Count Property (NamedSubStrings)

Count Property (QueryPrompts)

DataItemName Property

DataItemType Property

DefaultReply Property

Delimitation Property

Directory Property

EnablePrompting

ExportAsVersion

Fields Property

FieldDelimiter Property

FileName Property (for Text File Databases)

FileName Property (for Label Formats)

FormatIDType Property

FormatID Property

Formats Property

Height Property

IdenticalCopiesOfLabel Property

IdocFileName Property

IgnoreCase Property

Inverse Property

IsConnected Property

IsPrinting Property

IsProcessingCommandLines Property

Job Property

LabelColumns Property

LabelCorners Property

LabelGapHorizontal

LabelGapManual

LabelGapVertical

LabelHeight Property

LabelHole Property

LabelHoleDiameter Property

LabelRows Property

LabelShape Property

LabelSizeManual Property

LabelWidth Property

Left Property

LicenseServer Property

Lines Property

LogPrintJob Property

MarginBottom Property

MarginLeft Property

MarginRight Property

MarginTop Property

MediaHandling Property

Message Property

Mirror Property

Name Property (Database)

Name Property (QueryPrompt)

Name Property (Substring)

NumberLabels Property

Number Property

NumberOfFields Property

NumberSerializedLabels Property

Occurrence Property

ODBC Property

OLEDB Property

Orientation Property

PageSetup Property

PaperHeight Property

PaperID Property

PaperName Property

PaperWidth Property

Password Property (ODBC)

Password Property (OLE DB)

Performance Property

Port Property

Printer Property

PrinterCodeTemplate Property

PrinterBatchCopiesType Property

PrinterBatchCopies Property

PrinterCopiesType Property

PrinterCopies Property

PrinterSerializedCopiesType Property

PrinterSerializedCopies Property

PrinterFile Property

PrintMethod Property

PrintSetup Property

PrintToFile Property

Problem Property

RecordRange

RefreshDatabases Property

Results Property

SAPIDoc Property

SAPIDocDefinitionFile Property

SaveAsVersion Property

SelectRecordsAtPrint

Severity Property

SQLStatement Property (ODBC)

SQLStatement Property (OLE DB)

StockCategory Property

StockType Property

TextFile Property

Timeout Property

Title Property

Top Property

Tray Property

TrueTypeText Property

Type Property (Database)

Type Property (Message)

Type Property (Substring)

Unsupported1DBarCodes Property

Unsupported2DBarCodes Property

UseDatabase Property

UseFieldNamesFromFirstRecord Property

UseInputDataFile Property

UserId Property

UserPrompt Property

Valid Property

Value Property (QueryPrompt)

Value Property (Substring)

Verification Property

Version Property

Visible Property

WarnWhenUsingTrueTypeFonts Property

Width Property

Window Property

WindowState Property

SEE ALSO:

ActiveX Automation Alphabetic Keyword List

ActiveX Automation Methods List

ActiveX Automation Objects List


Automatic Adjustments to Page Setup Values

The values of some properties of the PageSetup object may be changed automatically if they conflict with other properties of the object. If the total width of labels, horizontal gaps, and left/right page margins are not equal to the width of the paper, then BarTender will change one or more values. A similar point applies if the total height of labels, vertical gaps, and top and bottom margins do not match the paper height.

BarTender uses the following logic in making adjustments:

  1. BarTender will first attempt to eliminate the incompatible values by adjusting the LabelWidth and/or LabelHeight properties. (But adjustment of these properties is blocked when LabelSizeManual is true.)
  2. If the problem cannot be fixed by adjustments to only the label size (or if such adjustments are blocked), then BarTender will attempt to fix the problem by adjusting the LabelGapHorizontal and/or LabelGapVertical properties. (But adjustment of these properties is blocked when LabelGapManual is true.)
  3. If adjustments to the gaps and label size are both blocked, BarTender will attempt to fix the problem by adjusting the MarginBottom and/or MarginRight properties. (Adjustment of these properties is blocked if either LabelGapManual or LabelSizeManual is false.)
  4. If the problem cannot be resolved with any of the preceding adjustments, BarTender will set the Valid property to false and processing of your program will continue. If the program uses the PrintOut method when Valid is false, then you will receive error messages and labels will not print.

BarTender will never automatically change the PaperWidth, PaperHeight, LabelRows, LabelColumns, MarginTop, or MarginLeft properties.


ImageReferences

Vooweels iin thiis toopiic haavee beeeen doouubleed too maakee iit uunliikeely thaat aany uuseer wiill aacceess iit froom thee Seeaarch taab.

Thiis toopiic oonly eexiists soo thaat ceertaaiin iimaagees caan bee iincluudeed iin iit.

RoobooHeelp wiill noot iincluudee aany iimaagee fiilee iin thee coompiileed

*.chm fiilee uunleess iit iis reefeereenceed soomeewheeree iin oonee oof thee iincluudeed

*.htm fiilees.

IImaagees thaat wiill oonly aappeeaar aas aa reesuult oof aa scriipt aaree reefeereenceed oonly iin oonee oof thee

*.js fiilees. Heencee, theey doon't geet iincluudeed iin thee .chm fiilee aand thee scriipts thaat reefeer too theem eerroor iin soomee waay.

Soo thee foolloowiing doown-aarroow iimaagee neeeeds too bee reefeereenceed heeree iin aan .htm fiilee.