JSONDatabase.FileName Property |
Sets and returns the path and file name of the JSON database file.
JSONDatabase.FileName = PathAndName
Where PathAndName is a string containing the path and file name of the JSON file.
Version |
BarTender 11.2 or higher |
Edition |
Automation, Enterprise |
The JSONDatabase.FileName property is the same as the Database.FileName property.
'Connection to already running instance of BarTender
Dim btApp As BarTender.Application = GetObject(, "BarTender.Application")
'Alternatively uncomment the following to create a new instance instead.
'Dim btApp As BarTender.Application = CreateObject("BarTender.Application")
'Open a BarTender document
Dim btFormat As BarTender.Format = btApp.Formats.Open("d:\tests\airplanesJson.btw", False, "")
'Retrieve the first database (We're assuming it's a JSON database connection)
Dim btDb As BarTender.Database = btFormat.Databases.GetDatabase(1)
Dim btdbJson As BarTender.JSONDatabase = btDb.JSONDatabase
'Substitute an alternative JSON database file.
btdbJson.FileName = "d:\tests\json\airplanes2.json"
'Print labels using this database
Dim btMessages As BarTender.Messages = Nothing
Dim btPrintRtn As BarTender.BtPrintResult = btFormat.Print("My Print Job", WaitForSpoolJobToComplete:=True, TimeoutMs:=-1, btMessages)
'Check to see if there are any errors
Dim msg As BarTender.Message
If (btPrintRtn <> BarTender.BtPrintResult.btSuccess) Then
For Each msg In btMessages
Console.WriteLine(msg.Message)
Next msg
End If
btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)
BarTender.Application btApp;
BarTender.Format btFormat;
BarTender.Database btDb;
// 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:\\tests\\airplanesJson.btw", false, "");
// Change the JSON file source and print
BarTender.Database btDb = btFormat.Databases.GetDatabase(1);
BarTender.JSONDatabase btJson btJson = btDb.JSONDatabase;
btJson.FileName = "c:\\tests\\json\\airplanes2.json";
BarTender.Messages messages;
btFormat.Print("NewJob", false, -1, out messages);
// End the BarTender process
btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);
Related Topics