I think the question I am asking is the following:
Is there a way to apply Paragraph styles on a conditional basis (until they encounter a specific character or word) or, if that is not possible, is it possible to create line breaks after character styles?
This is the problem I am trying to solve:
I am using InDesign's Data Merge functionality. I have data that I would like to format as lists. If possible I would like to combine data from multiple cells in one text frame, that gets formatted with nested styles. I would like each list element to have a bullet point, that I would prefer not to add to the csv file. The number of items in each list fluctuates, but I am fairly confident I can predict an upper limit. I would like to refrain from manual search and replace manipulation on the merged document.
I have tried four approaches.
The first approach was to insert each cell into a new line, and format the text cell with paragraph styles. What works well is the fact that extra empty lines are automatically removed when using
Remove Blank Lines for Empty Fields. My problem with this approach is that the number of list elements is not fixed, so I don't think I can use the
Next Style option in the paragraph style menu.
List one:¶ <<data_a1>>¶ <<data_a2>>¶ <<data_a3>>¶ List two:¶ <<data_b1>>¶ <<data_b2>>¶ <<data_b3>>¶
(regular line breaks are denoted by
My second approach was to create data fields in the csv file for the maximum amount of list items possible, adding them to the the text frame, and separating them with forced line breaks. I can then apply a paragraph style that has nested styles for the first line and the data fields. With this approach I end up without bullet point for the list items, since they are separated by forced line breaks and not paragraphs, and I end up with extra forced line breaks even when I turn on
Remove Blank Lines for Empty Fields in the Data Merge options panel. Here is what this looks like in InDesign. The two lists have a
list paragraph style applied, that has nested styles for the first line until it encounters a forced line break and a style for the list items
List one:¬ <<data_a1>>¬ <<data_a2>>¬ <<data_a3>>¶ List two:¬ <<data_b1>>¬ <<data_b2>>¬ <<data_b3>>¶
(forced line breaks are symbolized by
¬, paragraphs by
My third approach was to combine all list elements in one cell inside the csv file, separated by line breaks. Data Merge gets confused with this option.
My fourth approach was to have separate text boxes for the two lists, which have the data elements inserted like in my first approach. The problem with this is that the two lists are a fixed length apart, creating issues with very short lists and very long lists (the short ones have a lot of empty space in between, the long ones overflow the text box)