Atomik Roundtrip 2.1: Tutorials > Chapter 10 Tutorial 7 : Generated Text << >>

9.2 Using QuarkXPress tables

    1. Create a new QuarkXPress document with a document size of A4 (or US Letter if you prefer).
    2. Select the Tables tool from the QuarkXPress tool palette, and draw a large table box in the middle of the page.
    3. You will be presented with a dialog box asking you how many columns and rows the table will have.
    4. In this dialog you should select 15 rows, 5 columns, and ensure that ‘Cell Type’ is set to ‘Text Cells’, that ‘Link Cells’ is checked, and the ‘Link Order’ is set to ‘Left to Right, Top Down’. You’ll now see your table created on the page.

    1. Before we import any XML, we need to make a ruleset which will apply the appropriate styling and formatting to the data. In the case of a table box, this ruleset is actually incredibly simple. To explain how this works, it’s worth explaining a little bit about how QuarkXPress table boxes work.

    Although they look like a pretty complex object, a QuarkXPress table is no more than a group of boxes - albeit a clever group of boxes which can be resized and scaled interactively. When you select ‘Link Cells’ in the Table properties diaog (as you just did in the previous step), you’re effectively linking these boxes. If you don’t believe me, click on a cell in your table with the link tool (but be careful not to actually link it to anything!) You’ll see box links between each cell, just as you would had you manually created the boxes and linked them yourself.

    Atomik Roundtrip therefore sees each cell in the table as being a separate box in a chain of linked boxes. If you’re using QuarkXPress and want to move the cursor to the next box in the chain before filling up the current box, you’d press ‘enter’ on the numeric keypad : this inserts a ‘new box’ character into the text flow, which pushes the text following it into the next box in the chain. So if our QuarkXPress table is really just a chain of linked boxes, all our Roundtrip ruleset needs to do in order to ensure that each piece of data appears in a separate cell is to put one of these ‘new box’ characters after each piece of data.

    You’ll recall from previous tutorials that if you wish to insert one or more characters after an XML element, you can enter these characters in the ‘Post’ generated text field in the ruleset; and that’s exactly what we’re going to do now.

    1. Select ‘Create->Create Ruleset...’ from the Atomik Roundtrip menu. In the resulting dialog, choose ‘Tutorial 7.DTD’ from the DTD pop-up menu, name the ruleset you’re creating ‘Tutorial7a.rls’, and then click ‘OK’. You’ll be asked to choose an XML file to load with this ruleset - choose the file ‘Tutorial 7a.xml’.
    2. The ‘Edit Ruleset’ dialog will appear, allowing you to create new rules. In the DTD which you’ve just selected (which you can browse in the ‘DTD’ tab of the Roundtrip XML palette), each ‘cell’ is represented by an element called ‘TableData’. From the ‘Element’ pop-up menu in the Edit Ruleset dialog, choose ‘TableData’, and in the ‘Generated Text’ drop down section, add a New Box character (\b) into the ‘Post’ field. Then click ‘Add’ to save the rule you’ve just created.
    1. Now close the ‘Ruleset’ dialog, go to the ‘Roundtrip XML’ palette, and switch to the ‘XML’ tab. Drag & drop the ‘Table’ element from the hierarchy and drop it into the table you just created. You’ll see the XML data flowed into the table.
    1. Of course, this is a simple table to look at - but you can see that the import of the XML content using Atomik Roundtrip is achieved with just one rule - everything else you do to make the table look great is achieved using the table and text formatting functionality of QuarkXPress.