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

Apply new style to following paragraph throughout document

Participant ,
May 08, 2018 May 08, 2018

Copy link to clipboard

Copied

Hi all

Hopefully this is simple!…

I have document with a tonne of Heading 3 styles and I need to ensure that the first following paragraph - and only that first paragraph -  gets converted to a separately created untabbed body paragraph style.

How do I issue a search and replace command to achieve that?

NB: there are over 700 of these Heading 3 + first following paragraph instances.

Many thanks in advance for any guidance 🙂

VBW

M

Views

467

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

correct answers 1 Correct answer

Guide , May 08, 2018 May 08, 2018

A very short way! …

var myParas = app.activeDocument.stories.everyItem().paragraphs.everyItem().getElements(),

P = myParas.length,  p,

myPStylesList = ["Blue", "Red"]; // Names of the 2 Para Styles to be played!

for ( p = 0; p < P; p++ ) if ( myParas

.appliedParagraphStyle.name == myPStylesList[0] ) myParas[p+1].appliedParagraphStyle = myPStylesList[1]; 

Best,

Michel, from FRIdNGE

Votes

Translate

Translate
Community Expert ,
May 08, 2018 May 08, 2018

Copy link to clipboard

Copied

It is probably too late to edit your Head style and setup the Next Style as Body.

Try a script from Stephan Moebius

HilfDirSelbst

Mike Witherell

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 ,
May 08, 2018 May 08, 2018

Copy link to clipboard

Copied

A very short way! …

var myParas = app.activeDocument.stories.everyItem().paragraphs.everyItem().getElements(),

P = myParas.length,  p,

myPStylesList = ["Blue", "Red"]; // Names of the 2 Para Styles to be played!

for ( p = 0; p < P; p++ ) if ( myParas

.appliedParagraphStyle.name == myPStylesList[0] ) myParas[p+1].appliedParagraphStyle = myPStylesList[1]; 

Best,

Michel, from FRIdNGE

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
Participant ,
May 09, 2018 May 09, 2018

Copy link to clipboard

Copied

Hi Michel

That worked brilliantly. Thank you so much!

The final script was:

var myParas = app.activeDocument.stories.everyItem().paragraphs.everyItem().getElements(), 

P = myParas.length,  p, 

myPStylesList = ["Heading 3", "Untabbed"]; 

for ( p = 0; p < P; p++ ) if ( myParas

.appliedParagraphStyle.name == myPStylesList[0] ) myParas[p+1].appliedParagraphStyle = myPStylesList[1];

Very best wishes to both you and Michael for the replies

Mark

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 ,
May 09, 2018 May 09, 2018

Copy link to clipboard

Copied

LATEST

Michel, nice!

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