Building tables in QuarkXPress has long been painful without buying a third-party XTension. Fortunately, XPress now has a Table tool which lets you create simple tables quickly and painlessly. Whether you need a table for financial data in an annual report, a form for ordering supplies, or a chart listing this week's Top Ten Pop Songs, the Table tool will make your life a happier place.
Table Terms. In order for you make and use tables, you need to understand some table terminlogy.
- A cell is one box of information within a table. Tables consist of a grid of cells, and cells are always picture or text boxes.
- A field is the contents of one cell; in XPress, cells can contain either text, pictures, or be blank.
- A row is a horizontal series of cells in a table (there is normally more than one row in a table).
- A column is a vertical series of cells in a table (there is normally more than one column in a table).
- A table is the entire unit, all columns and rows containing cells.
- A delimiter is a text character that tells XPress to separate one field from the next. The primary delimiter characters are usually a tab and a new paragraph character, but it can also be a comma, a space, or any other character. You only need to worry about delimiters when converting text into a table or a table into text (I'll cover both of these later in this section).
It's important to remember that tables in QuarkXPress are actually just grids of text and picture boxes separated by regular ol' lines. You could manually make a table with boxes and lines, but it would take much longer than using the Table tool and you wouldn't be able to take advantage of a few special table features (like combining cells together).
You can make a table anywhere on your page (or pasteboard) by selecting the Table tool from the Tool palette (that's the one that looks like a small flyswatter) and dragging out a box, just like you would any picture or text box. The program immediately displays the Table Properties dialog box, in which you can enter the number of columns and rows you want in the table, as well as whether you want the cells to be text or picture boxes (see Figure 3-82). Don't worry, you can always change the cell type, or insert (or delete) rows and columns later. You can even change the tab order of your cells and link the cells together. I'll discuss these features soon.
Figure 3-82 Drawing a new table
Once you have drawn a table, you can insert text or pictures into each cell, just as though each cell were a text or picture box (which, as I said before, it actually is). So you can click in the cell with the Content tool and either type or use Get Text or Get Picture. If you have linked your cells together (see "Linking Text Cells," below), any text you type or import flows from cell to cell. If you have not, it only flows into the cell in which the text cursor is flashing.
Convert Text to Table. QuarkXPress lets you turn any selected block of text into a table by choosing Convert Text to Table from the Item menu. This gives you the Convert Text to Table dialog box (see Figure 3-83), which lets you specify the row and column delimiters, and the order you want the table filled. XPress automatically calculates the number of columns and rows, so you don't have to type those (though you can override these numbers if you dare).
Figure 3-83 Convert Text to Table
Let's say you need to format some data from Microsoft Excel. You can tell Excel to export the data using a tab-delimited format, which places tabs between each field and a paragraph return at the end of each row. Import that text file into XPress, select it, specify these delimiters, and press OK. QuarkXPress does the rest and builds a table object on your page, placing the proper fields in each cell. The original text box is still there; if you don't want it anymore, you'll have to delete it yourself.
Note that some comma-delimited text files use a format in which any fields that actually contain commas are surrounded by quotations marks. Currently, XPress cannot deal with these kinds of files, so it's much better to use tab-delimited text whenever possible.
QuarkXPress also lets you convert a table into text; I'll cover that later in this section.
Setting tab order. XPress lets you specify the table's "tab order"—the order in which you jump from cell to cell. You can select this option in the Table Properties dialog box when you first create the table, or when you use the Convert Text to Table command. Or you can change it later by selecting the table and choosing Modify from the Item menu, and clicking the Table tab. Normally, you'll accept the default (from left to right in the first row, and then downward through the rows). However, you can also choose one of three other orderings: Right to Left, Top Down; Top Down, Left to Right; and Top Down, Right to Left (sorry, I can't find any way to start the data at the bottom and tab upward).
Linking text cells. While XPress 5 didn't allow any linking of text cells in a table, XPress 6 is more flexible, letting you link text cells within a table together, or to any other text box or text cell. You can link cells automatically, following a specified link order, or linked manually in any order you want.
To link cells automatically, turn on the Link Cells option in the Table Properties dialog box when creating a table. Then choose one of four choices from the Link Order popup menu—the same orderings as in the Tab Order popup menu. Text placed into a table cell flows from cell to cell in the link order. If you forget to set this when you first create the table, you can select Link Text Cells from the Table submenu (in the Item menu or the context menu) while the Item tool is selected. Then you can choose the link order in the Table tab of the Modify dialog box. However, you can't apply automatic linking when there's already text in the cells.
Since text table cells are really text boxes, you can also use the Linking tool to manually link cells together. Use the Linking and Unlinking tools as I describe earlier in this chapter. You can also link text between cells in a table and any other text box.
Of course, if you link the cells in your table and then try to enter text in the third cell over, the text appears in the first cell. That is, linked cells act just like linked text boxes. This confuses even advanced users.
Note that if you later save your document as an XPress 5 file, the links will be lost. To avoid this problem, select Convert Table to Group from the Table submenu (in the Item menu or the context menu; see "Convert Table to Text or Group," later in this section).
Changing Rows and Columns
Now that you have a table, it's time to start formatting it: changing the size of the table, adding or removing columns or rows, combining and splitting cells, and changing the size of columns or rows.
Resizing the table. There are two ways to resize your table: you can drag one of the table's corner or side handles, or you can drag the edge of the table itself. The difference between these two methods is important. If you drag a corner or side handle, XPress changes all the cells in the table. For instance, if you pull the right side handle out, you change the width of every cell in the table.
You can hold down a modifier key while dragging a side or corner handle, too. If you hold down the Shift key while you drag, the table is resized to a square. The Command (Ctrl) key resizes the contents of each cell along with the table (Command-Option-Shift-drag or Ctrl-Alt-Shift-drag resizes the table and keeps the same height-width proportion.)
If, however, you click and drag the edge of the table (on any point where there isn't a handle), then you extend only the cells along that edge (see Figure 3-84).
Figure 3-84 Resizing your tables
Deleting columns and rows. To delete a column or row, you need to select a whole column or row of cells. To do this, select the table with the Content tool and then move the cursor just outside the table until the cursor icon changes to a horizontal or vertical black arrow. Clicking when you see this cursor results in a whole row or column being selected. Once you have selected a row or column, you can delete it by selecting Delete from the Table submenu (under the Item menu, or in the context-sensitive menu).
To select more than one contiguous column or row, drag the black-arrow cursor over additional columns or rows. To select discontinuous columns or rows, hold down the Shift key as you select each column or row.
Adding columns or rows. To add a new column or row, use the Content tool and place the cursor in a table cell. Now select Insert Row or Insert Column from the Table submenu (under the Item menu, or in the context-sensitive menu). Either way, XPress displays the Insert dialog box, which lets you choose how many rows or columns you want to add, as well as where the new rows or columns should be added (see Figure 3-85). If you turn on the Keep Attributes option, the added cells take on the formatting of the selected cell. When this option is off, you just get default, no-format cells.
Figure 3-85 Inserting rows or columns
Combining and splitting cells. Cells don't have to be exactly one row tall or one column wide. You can make a cell span across multiple rows or columns by selecting two or more cells and combining them. To select more than one cell in a table, Shift-click on each cell you want selected. Or, you can also just drag the Content tool over two or more cells to select them all. If you select a cell by accident, you can Shift-click on it to deselect it. Then, when you've selected two or more cells in a row or column, choose the Combine Cells feature from the Table submenu (in the Item menu, or in the context-sensitive menu). Combining cells eliminates all content from all selected cells except the one in the upper-left-most selected cell. That content will fill the newly combined cell.
If you later decide that you want combined cells returned to their original appearance, you can split them. Select the combined cell and choose Split Cell from the Table submenu (in the Item menu, or in the context-sensitive menu). Note that you can only split cells you've already combined; not regular cells.
Changing row and column size. You can resize a single row or column by dragging the gridlines between the rows and columns with the Content tool. This can be a little tricky; you have to move the cursor over the gridline until you see it change into a cross-like double-headed arrow. Once you see that cursor, you can click and drag the gridline.
Note that QuarkXPress has no way to automatically resize column or row boundaries based on the content of the cells. Maybe in a later version of the program it will offer an auto-expand feature.
There's one other way to change your row or column size: place the cursor in a cell and open the Modify dialog box (select Modify from the Item menu, press Command-M (Ctrl-M), or Command/Ctrl-double-click on the table). Here, switch to the Cell tab and set the height or width of this cell— changing it for this one cell changes it for all the cells in that row or column.
If you have more than one cell selected, you can click the Distribute Evenly button in the Cell tab of the Modify dialog box to equalize the rows or columns. That is, it takes the total width or height of the cells and divides it up equally for each row or column you have selected. This is extremely useful when you want several rows or columns to be the same width but aren't sure exactly what that width should be.
Maintain Geometry. When you select a table and open the Modify dialog box, you'll notice a feature called Maintain Geometry on the Table tab (see Figure 3-86). You can also select this option from the Table submenu (in the Item menu, or in the context-sensitive menu). When this checkbox is turned on, XPress will not change the size of the table when you add or remove rows or columns—it simply resizes the remaining rows and columns proportionally. It also maintains the table dimensions when you change row or column size. If you leave this feature turned off, then the table size actually changes when you add or remove columns.
Figure 3-86 The Table tab of the Modify dialog box
Also, when Maintain Geometry is turned on, you cannot resize a table by dragging one of its outside edges. You can, however, still use the corner or side handles.
Remember that each cell in a table is just a picture box or a text box, and you can do almost anything to a cell that you would to an ordinary box. For instance, to change a cell from a text box into a picture box, place the cursor inside it and choose Picture from the Content submenu (under the Item menu or the context-sensitive menu).
Similarly, to change the background color of the cell, you can use the Color palette or the Modify dialog box. You can even format a cell to have a background of None or a gradient.
Here's something you can do to cells in a table that you cannot do with regular picture or text boxes: You can apply formatting to the contents of more than one cell at a time. For example, if you want to apply a paragraph style to all the cells in a row, you can select that row (see "Changing Rows and Columns," above) and click on the style in the Style Sheets palette. If you want your headings to be rotated in the cells, you can select that row, open the Modify dialog box, and change the Text Angle field.
Formatting the Table Box
There is another box which contains the cells of a table and which is behind them, called the table box. However, by default, table cells have a white background so you can't normally see it. To change the color of the table box itself, pick a color in the Table tab of the Modify dialog box or select the table with the Item tool and then pick a color from the Colors palette. Now, if you change the background color of the cells to None either by selecting them or changing the table preferences (see below), you can see the table box's color. By default, the table box itself has a transparent background so you can see through it to objects below.
The table box also has a frame that surrounds the table. You can change its properties by first selecting the table with the Item tool, and then choosing Modify from the Item menu, and selecting the Frame tab.
Now that you know how to format the stuff inside cells, it's time to format the stuff around them: the gridlines. There are three ways to select the gridlines.
- You can select the table with the Item tool (instead of the Content tool) and open the Modify dialog box (press Command/Ctrl-M). Choose the Grid tab of the Modify dialog box (see Figure 3-87), and then click on one of the buttons along the right side of the dialog box: vertical gridlines, horizontal gridlines, or all gridlines.
Figure 3-87 The Grid tab of the Modify dialog box
- With the Content tool selected, you can choose Select Vertical, Select Horizontal, Select Borders, or Select All from the Gridlines submenu (under the Item menu, or in the context-sensitive menu). When you choose Select Borders, XPress selects the four outer sides of the table.
- You can choose one or more gridlines in your table by Shift-clicking on them with the Content tool.
Once you have one or more gridlines selected, you can specify color, style, and width in the Grid tab of the Modify dialog box. Or, if the Modify dialog box isn't open, you can change these settings in the Style menu or the context-sensitive menu. Remember that the gridlines are exactly like regular lines in XPress, so you can use custom dashes and stripes, change the gap color, or whatever else you choose to do.
Sometimes you'll want to make a table that has no gridlines—where the cells abut each other with no lines in between. To do this, select the lines you want to change and set their color to None. Note that when you have transparent gridlines, you're looking at the table box; if you've changed the table box's color, then you'll see this color "peeking through" the gridline.
Figure 3-88 One-celled tables
Convert Table to Text or Group
You can extract the contents of a selected table into a single text box by choosing Convert Table to Text from the Table submenu (under the Item menu or in the context-sensitive menu). XPress gives you choices regarding delimiter characters (what to put between the contents of each cell), the text extraction order, and the choice to delete the table once converted (see Figure 3-90).
Figure 3-90 Convert Table to Text
When you click OK the program generates a new text box with the contents from the table, separated by delimiters (usually tab characters). You can position this text box someplace on your page, or use Save Text (from the File menu) to export the text to disk. For instance, you might want to export the table to disk as a text file if your client or accounting department needs a text version of your table to import into a spreadsheet.
Picture cells in your table get automatically converted to anchored picture boxes when you extract the data with Convert Table to Text.
You can also convert a table to a group of text boxes by selecting Convert Table to Group from the Table submenu (under the Item menu or the context-sensitive menu). The table is replaced with grouped boxes. You might do this if you were saving back to QuarkXPress 5 format when you're using features not supported by that version.
Default Preference Settings
Are you tired of changing the gridlines in all your tables to half a point instead of one point? Do the cells in your tables always have the same background color? Do you want your table text to be vertically centered in your table's cells? Don't tire yourself by change these manually every time you make a table; instead, double-click on the Table tool to open the Tool tab of the Preferences dialog box, and click Modify to change the Table tool's default settings (see Figure 3-91).
Figure 3-91 Table tool preferences
Of course, like other document preferences, if a document is open when you change these settings, it affects just that one document. To change the application's default settings for any newly created documents, change these defaults with no documents open.
Note that these preferences affect both how tables appear when you draw them with the Table tool and when XPress makes a table for you using the Convert Text to Table feature.
Tables for Web Layouts
While I don't cover building Web layouts and exporting to HTML until Chapter 14, Going Online With QuarkXPress, it's worth noting here that you can use the Table tool to produce tables in Web layouts. Then, when you export HTML from your Web layout, XPress automatically converts your table into an HTML table. However, because HTML tables have severe restrictions, XPress simply won't let you do much formatting to tables that you create in a Web layout. For instance, gridlines must be a minimum of 2 pixels, you cannot change their color or style, and you cannot rotate text in a cell.
Therefore, if you want to use any of the more fancy table formatting, you must first turn on the Convert Table to Graphic checkbox in the Modify dialog box. This way, XPress exports your table as a picture (typically a GIF image) instead of an HTML table. If you turn your print layout into a Web layout, QuarkXPress turns this checkbox on by default.