GREP Styles in Adobe InDesign
I posted a question a few days ago about importing data to an InDesign file from a MySQL database using XML. I have looked into it and thanks to some help received from other sources think the project should be fairly straightforward.
Essentially, we have a unique product ID which is 5 digits long. When importing it, we would like the last digits to be used as a colour for a barcode. Each digit will be assigned a colour (from 0-9), and the data will be presented in a table 开发者_开发知识库as follows:
12345
ROW 1 COLOUR
ROW 2 COLOUR
ROW 3 COLOUR
My question is, does anyone have experience with using GREP Styles within Adobe InDesign, and could explain how we might achieve this (i.e. setting the cell style of the cells according to the last two digits in the number)?
In general: Each cell is its own text story. With a simple GREP search you can not search for contents of multiple cells with one search, and you can not modify the style of one cell based on the contents of another cell or text outside of the table. You can of course accomplish this with some more advanced scripting or a plugin.
I'm not quite sure if I'm answering the correct question as it's not clear what you are trying to accomplish. Maybe you could create some example input and output data clearly showing what text you want what style applied to.
There are two basic questions here. Can you import XML into InDesign and can ou apply formatting to this text in a specific way.
Happily the answer to both of these questions is YES!
You can learn almost everything you need from my book: A Designer's Guide for Adobe InDesign and XML.
InDesign can import XML and apply formatting automatically based on the tag name. InDesign also provides grep styling and nested styling.
Tables are a scarier process. You can import data into tables using XML, but it is not as straightforward as using paragraph-based text. A better way to accomplish XML-based tables is to use an XSLT to build native InDesign tables from the data.
You can then apply character, grep or nested styles to the data based on the tag names.
精彩评论