Using Fixed-Width Text Files

In a fixed-width text file, data is contained in columns that are of a fixed width (meaning that each column contains a certain number of character positions). Data that does not fill the width of the column is padded with filler characters, which are usually spaces or zeroes. Sometimes, your fixed-width text file uses special characters to visually delineate one column from the next.

When you use the Database Setup wizard to connect to the database, BarTender detects the fixed-width fields, whether they are defined by the number of characters or by a delineation, and then configures your database automatically, although you can modify this configuration.

To start the Database Setup wizard to connect to a database for the first time, click Database Connection Setup on the File menu. Alternatively, click on the main toolbar.

To start the wizard for an existing connection, click Configure Connection in the Database Setup dialog.

ClosedFixed-Width Text File Example

The following example shows records that have fixed-width fields. The first field in each record has eight character positions, the second has ten, and the third has ten.

0543166 Oranges   Perishable

17890   CantaloupePerishable

1203768 Apples    Perishable

1029384 Bananas   Perishable

Notice that in the second record, no delimiting character separates "Cantaloupe" from "Perishable". No such character is needed, because you can configure your document to always treat the 19th character as the beginning of the third field. To do this, use one of the following methods on the Field Widths page of the Database Setup wizard:

ClosedDelineated Fixed-Width Text File Example

The following example shows records that have delineated fixed-width fields.

In this case, the delimiter is the vertical bar (|) character, but this file differs from a basic delimited file in that the vertical bar appears to the right and left of the table in addition to between the data fields. Also, this file contains horizontal elements (- and +), which the Database Setup wizard must ignore when it converts this file to a database.

When Fixed Width Fields is selected as the Format option on the File Format page of the wizard, the Field Separation list includes the following options:

Related Topics