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

Paragraph style in a group of styles

Community Beginner ,
Aug 18, 2011 Aug 18, 2011

Copy link to clipboard

Copied

How do you refer to a paragraph style that is in a group of styles?

Here is the script:

frm.paragraphs[0].appliedParagraphStyle = "Title";

But the problem is that the style "Title" is in a group entitled "Headings" So how do I refer to it?

Thanks.

TOPICS
Scripting

Views

3.4K

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

Community Expert , Aug 18, 2011 Aug 18, 2011

Hi
When paragraphStyles in paragraphStyleGroup, paragraphStyles parent is paragraphStyleGroup.
apply styles like below:

var pStyleGroup = app.activeDocument.paragraphStyleGroups.itemByName('Headings');
var titleStyle = pStyleGroup.paragraphStyles.itemByName('Title')
frm.paragraphs[0].appliedParagraphStyle = titleStyle;

Ten

Votes

Translate

Translate
Community Expert ,
Aug 18, 2011 Aug 18, 2011

Copy link to clipboard

Copied

Hi
When paragraphStyles in paragraphStyleGroup, paragraphStyles parent is paragraphStyleGroup.
apply styles like below:

var pStyleGroup = app.activeDocument.paragraphStyleGroups.itemByName('Headings');
var titleStyle = pStyleGroup.paragraphStyles.itemByName('Title')
frm.paragraphs[0].appliedParagraphStyle = titleStyle;

Ten

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 ,
Aug 18, 2011 Aug 18, 2011

Copy link to clipboard

Copied

Thanks, that was the answer I needed. I really appreciate it.

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 ,
Sep 12, 2016 Sep 12, 2016

Copy link to clipboard

Copied

Hi Ten,

Can you help me??

My problem is how to find style groups style?

My english is bad so please consider this.

Example:

app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;

app.findGrepPreferences.findWhat = "(.+?)";

app.findGrepPreferences.appliedCharacterStyle = "TXT1:TXT1_FrutigerLTCom";

app.changeGrepPreferences.appliedCharacterStyle ="TXT3:TXT3_STIXRegular";

app.activeDocument.changeGrep();

app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;

This is not working because of group of style.

-Sumit

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 ,
Sep 12, 2016 Sep 12, 2016

Copy link to clipboard

Copied

Try this,

app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;

app.findGrepPreferences.findWhat = "(.+?)";

app.findGrepPreferences.appliedCharacterStyle = app.activeDocument.characterStyleGroups.item("TXT1").characterStyles.item("TXT1_FrutigerLTCom");

app.changeGrepPreferences.appliedCharacterStyle = app.activeDocument.characterStyleGroups.item("TXT3").characterStyles.item("TXT3_STIXRegular");

app.activeDocument.changeGrep();

app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;

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 ,
Sep 14, 2016 Sep 14, 2016

Copy link to clipboard

Copied

LATEST

Thank you so much Sajeev Ji!

It's working fine.

-Sumit

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