• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Automadically Apply Paragraph Style in Number List

Engaged ,
Jun 14, 2018 Jun 14, 2018

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

Views

572

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 14, 2018 Jun 14, 2018

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).

none.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 16, 2018 Jun 16, 2018

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."

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 16, 2018 Jun 16, 2018

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 17, 2018 Jun 17, 2018

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*.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 17, 2018 Jun 17, 2018

Copy link to clipboard

Copied

… and how do you play with an auto-num para style?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 17, 2018 Jun 17, 2018

Copy link to clipboard

Copied

Here you go: auto-numbs, in one click.

auto.gif

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 19, 2018 Jun 19, 2018

Copy link to clipboard

Copied

Okay. Thanks for the help. But this is also going to be in a Data Merge Document

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 19, 2018 Jun 19, 2018

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines