PrinterCodeTemplate.Export Method |
Exports the current document to either a single printer template or one template for formatting information and a second for variable data.
PrinterCodeTemplate.Export(PrintSystemName, BtPctExportType, FormatOrCombinedExportPath, DataExportPath, Messages)
Where
PrintSystemName identifies the print system to be used.
BtPctExportType specifies whether to create one of two templates; see constants below.
FormatOrCombinedExportPath identifies the path and file name of the template. This parameter is passed as the path and file name of the format template if the BtPctExportType parameter is btPctExportCombined.
DataExportPath identifies the path and file name of the data template. This property is ignored if the BtPctExportType parameter is btPctExportCombined.
Messages returns one or more Message objects from the export method.
The BtPctExportType parameter can be set to any of the following constants:
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. |
btPctExportToPort |
2 |
The information is exported to a port. When this option is selected, the FormatOrCombinedExportPath and DataExportPath parameters are ignored. |
Version |
BarTender 7.50 or higher |
Edition |
Automation, Enterprise Automation |
The value of the PrintSystemName parameter must be an exact match for one of the print systems listed in the Printer Code Template Setup dialog in BarTender. BarTender will validate the settings.
If there are no warning or error conditions, the PrinterCodeTemplate.Export method will return true, and the printer code template will be exported successfully. No Message objects will be created.
If there is an error condition, the PrinterCodeTemplate.Export method will return false and the printer code template will not be exported. A Message object will be created for each error condition.
If there is a warning condition, the PrinterCodeTemplate.Export method will return true and the printer code template will be exported successfully. A Message object will be created for each warning condition.
'Declare a BarTender application variable
Dim btApp As BarTender.Application
'Declare a BarTender document variable
Dim btFormat As BarTender.Format
'Declare a BarTender printer code template variable
Dim btPCT As BarTender.PrinterCodeTemplate
'Declare a BarTender messages variable to hold all messages
Dim btMessages As BarTender.Messages = Nothing
'Create a new instance of BarTender
btApp = New BarTender.Application
'Set the BarTender application visible
btApp.Visible = True
'Open a BarTender document
btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")
'Set the printer code template variable
btPCT = btFormat.PrinterCodeTemplate
'Export the printer code template
btPCT.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, "c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)
'End the BarTender process
btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)
// Declare a BarTender application variable
BarTender.Application btApp;
// Declare a BarTender document variable
BarTender.Format btFormat;
// Declare a BarTender printer code template variable
BarTender.PrinterCodeTemplate btPCT;
// Declare a BarTender messages variable to hold all messages
BarTender.Messages btMessages;
// Declare an object variable
System.Object obj = null;
// Create a new instance of BarTender
btApp = new BarTender.Application();
// Set the BarTender application visible
btApp.Visible = true;
// Open a BarTender document
btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");
// Set the printer code template variable
btPCT = btFormat.PrinterCodeTemplate;
// Export the printer code template
btPCT.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, "c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);
// Set the messages variable to the object
btMessages = obj as BarTender.Messages;
// End the BarTender process
btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);