1

I have an xml file with a table containing several rows like this:

   <Row>
    <Cell><Data ss:Type="String">Item</Data></Cell>
    <Cell><Data ss:Type="String">Color</Data></Cell>
    <Cell><Data ss:Type="String">Price</Data></Cell>
   </Row>

When I drag this example Row from the Structure pane into the document, a top row and leading spaces are added to the content:

enter image description here

I can manually remove the spaces, but when I relink the xml, they return. How can I make sure that these spaces are not being added, I would like to have the xml import like this:

enter image description here

1
  • If memory serves, InDesign reads the whitespace in the XML file itself (sometimes a blessing, sometimes a curse). Have you tried removing the line breaks between the <Cell> tags in the XML file? Commented Feb 26, 2021 at 8:46

1 Answer 1

1

Sample XML:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<data-set xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
    <Row>
        <Cell><Data ss:Type="String">Item 1</Data></Cell>
        <Cell><Data ss:Type="String">Color 1</Data></Cell>
        <Cell><Data ss:Type="String">Price 1</Data></Cell>
    </Row>
    <Row>
        <Cell><Data ss:Type="String">Item 2</Data></Cell>
        <Cell><Data ss:Type="String">Color 2</Data></Cell>
        <Cell><Data ss:Type="String">Price 2</Data></Cell>
    </Row>
    <Row>
        <Cell><Data ss:Type="String">Item 3</Data></Cell>
        <Cell><Data ss:Type="String">Color 3</Data></Cell>
        <Cell><Data ss:Type="String">Price 3</Data></Cell>
    </Row>
</data-set>

Step 1

  1. Create blank InDesign document.

  2. Import the XML file: File > Import XML... and select the file we created above.

  3. Deselect all options and click OK.

    Import XML options 1

Step 2

  1. Enable Structure pane by View > Structure > Show Structure.

    Structure pane

  2. Delete everything except the first Row object.

    Delete every Row except first

  3. Drag the data-set object on to the document page.

    Drag XML root to document page

Step 3

  1. Highlight the text frame and open the Story Editor from Edit > Edit in Story Editor.

  2. Edit the tags in the Story Editor exactly as you would like them to appear. In your example, the following seems to be right.

    XML tags before

    XML tags after

  3. You might come back here later to add some required spacing. This is dependent on how you want your data presented or the design your are going for. If you want the data to fill tables, then use tabs between cell data so that you can easily convert later on.

Step 4

  1. Re-import the XML file but this time change some settings.

    XML Import dialog with settings checked

Result

You should now have what you were looking for.

Final result

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.