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.
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
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
Copy link to clipboard
Copied
Thanks, that was the answer I needed. I really appreciate it.
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.
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;
Copy link to clipboard
Copied
Thank you so much Sajeev Ji!
It's working fine.