Using the Format Object |
The Format object represents a BarTender document (*.btw). Format objects are opened in an instance of the BarTender application, which provides access to a wide range of BarTender functionality. When you use the Format object, you can easily open, save, and print documents; change database options; and modify text and barcode data.
Use the Format object to manipulate existing documents by changing print settings and accessing object properties. You cannot use this object to modify the layout of templates in a document or to create new documents.
The Application object contains a list of all documents that are currently open in BarTender and which are accessed through the Application object's Formats collection object. This collection object also provides a way to open, close, and save BarTender documents.
A BarTender document is opened by calling the Formats collection object's Open method. This method returns a Format object, which represents the document that was just opened. The Formats.Open method has three arguments. The first argument is required and specifies the document to open. The second argument is a Boolean: if it is true, the method closes the default blank "Document1" document that BarTender automatically opens when it starts. (It cannot close documents that have any other name.) The third argument specifies a printer to use.
The following sample code shows how to open a BarTender document.
You can close a BarTender document by calling the Format.Close method. The following sample code shows how to close a document.
The Format.Close method takes a BtSaveOptions parameter, with which the user can choose whether to save, prompt for save, or discard changes that were made to the document.
When a Format object is no longer in use by your client application, the Format.Close method should be called. Failure to do so leaves a document open in BarTender unnecessarily and consumes resources.
Related Topics