Mobile app version of vmapp.org
Login or Join
Annie732

: Can I give an XML-defined block of text a background color in InDesign? I think I'm approaching this from the wrong direction, so am happy to adapt my workflow, but this is what I'm currently

@Annie732

Posted in: #AdobeIndesign #PageLayout

I think I'm approaching this from the wrong direction, so am happy to adapt my workflow, but this is what I'm currently doing: I'm importing XML, which looks like this, into InDesign:

<Story>
<h1>Heading</h1>
<body>
<p>An awesome paragraph.</p>
<p>An even more awesome paragraph.</p>
</body>
<coloredblock>
<h1>Heading for a colored block</h1>
<body>
<p>Paragraph of a colored block.</p>
<p>Another paragraph.</p>
</body>
</coloredblock>
</Story>


I want <coloredblock> to stay within the text flow (I'm importing all this XML into the document's text frame), but to have a background color, and ideally have some inner padding - essentially, to look like the code block above in comparison with this body text.

Is this achievable? Do I need to make it as a separate text frame? If so, is there a way to make the <coloredblock> XML import as a separate text frame?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Annie732

2 Comments

Sorted by latest first Latest Oldest Best

 

@Welton168

If you have InDesign CC 2015, you can simply call paragraph shading options in the paragraph style settings. It will let you set the background and the indents can be used for inner margins.

Otherwise, you cannot create frames on the fly with XML Import. What you can do then depends on your layout. Id the content is stable and will always be structure the same way, you can tag a frame so it receives the data at the time of import.
If the data can't be foreseen, then you would need afterwards actions like a script for example.

10% popularity Vote Up Vote Down


 

@Turnbaugh909

Indesign can have paragraph styles and character styles nested inside those paragraph styles.

Because of this you can create a character style that's got the background colour (that's what this is within InDesign), some padding and perhaps even a slightly bolder weight.

You can then assign this to a keyboard shortcut, so everytime you want to highlight some part of the XML you can do this with just a selection and then a quick tap of the keyboard shortcut.

// I assume you're making some documentation or tutorial content and will need to do this often to show parts of the code. Something like this:

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme