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

Apply conditional text in a certain paragraph style

Participant ,
Jun 21, 2018 Jun 21, 2018

Copy link to clipboard

Copied

How are friends, could anyone tell me how I could apply conditional text "TEACHER" only in a particular paragraph style? Thanks for the help, thank you.

TOPICS
Scripting

Views

1.1K

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

Advocate , Jun 21, 2018 Jun 21, 2018

Hello there,

               Try this below code.

applyCondition();

function applyCondition(){

    var myParaStyle = 'TEACHER';

    app.findTextPreferences.appliedParagraphStyle = myParaStyle;

    var found = app.documents[0].findText();

    var c = 0;

    while(c < found.length){

        found.paragraphs.everyItem().appliedConditions = app.documents[0].conditions.item('TEACHER');

        c++;

        }

    }

Votes

Translate

Translate
Advocate ,
Jun 21, 2018 Jun 21, 2018

Copy link to clipboard

Copied

Hello there,

               Try this below code.

applyCondition();

function applyCondition(){

    var myParaStyle = 'TEACHER';

    app.findTextPreferences.appliedParagraphStyle = myParaStyle;

    var found = app.documents[0].findText();

    var c = 0;

    while(c < found.length){

        found.paragraphs.everyItem().appliedConditions = app.documents[0].conditions.item('TEACHER');

        c++;

        }

    }

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 ,
Jun 21, 2018 Jun 21, 2018

Copy link to clipboard

Copied

Thanks my friend. Perfect.

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 Beginner ,
Jul 23, 2021 Jul 23, 2021

Copy link to clipboard

Copied

Hi... so I tried this... it's .jsx right? I changed the 'Teacher' to my corresponding paragraph style and it didn't work. Bit lost as to how this works.

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 ,
Jul 24, 2021 Jul 24, 2021

Copy link to clipboard

Copied

LATEST

For readers, if not included in a more complete process, no need a script for such a simple work! A simple F/R will be enough.

 

(^/)  The Jedi

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