Copy link to clipboard
Copied
If I have a list
1. Food
2. none
3. Grapes
Is there a script that will apply a paragraph style only if the item value is not none?
1. Food (Paragraph Style)
2. none (dont apply a style)
3. Grapes (Paragraph Style)
Thanks
Copy link to clipboard
Copied
You can’t *automatically* apply Para style. At least, you must: 1) select text, 2) click on para style name / hit KB command / whatever.
GREP as a paragraph style option does the trick, but it applies character style, not paragraph.
However, that’s all we can do, I guess: apply character style to the whole paragraph, containing the word *none*.
All three paragraphs in a screenshot below have the same para style applied, and the one with the word none has character style applied to the whole paragraph (bad practice, but I couldn’t find better *one click* solution).
Copy link to clipboard
Copied
Do a find/change (and I suppose you could script this)...
Find what: \d\.\h(?!none)
Change format: Paragraph style you need for the "not none" lines.
You might have to change this depending on how the numbering is actually set up. I based it on: digit, period, horizontal space, Negative Lookahead for "none."
Copy link to clipboard
Copied
Now that I think about it...you could save the above Find/Change query, then use the ChainGREP script, which lets you save a query or set of queries as a one-click script...assign a keyboard shortcut to that script and you have your one-click solution.
Copy link to clipboard
Copied
Yup, your approach is much better!
What I like most:
1. No Character styles used.
2. Paragraphs with None are truly omitted. If they have some special formatting (and it may be different on each such paragraph), it is preserved. Not very likely in a *real world*, but plays well with original request.
And yes, it can be made *one-click*.
Copy link to clipboard
Copied
… and how do you play with an auto-num para style?
Copy link to clipboard
Copied
Here you go: auto-numbs, in one click.
Copy link to clipboard
Copied
Okay. Thanks for the help. But this is also going to be in a Data Merge Document
Copy link to clipboard
Copied
openskies2009 wrote
If I have a list
1. Food
2. none
3. Grapes
Is there a script that will apply a paragraph style only if the item value is not none?
1. Food (Paragraph Style)
2. none (dont apply a style)
3. Grapes (Paragraph Style)
Thanks
Hi openskies2009 ,
I'm not clear what you exactly want to accomplish.
What I understand is that you want to apply a paragraph style to paragraphs where the actual contents is not "x", right?
If the contents of the paragraph reads "x" do nothing to the paragraph. The text you want to format is the result of a data merge action, right?
( Read "x" as "none" like in your sample. )
Is the numbering of the list automatic numbering?
Or did the data merge process also do the numbering?
Regards,
Uwe