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

How do I handle Style Groups in InDesign Scripting?

New Here ,
May 02, 2013 May 02, 2013

Hi,

I am relatively new to InDesign scripting.

I'm trying to map Paragraph Styles to CSS, and it seemed to be working fine, till I came across Style Groups -

Styles belonging to a group are identified as - Root Style Group name : Child style group name : ...... : Style name


Because of this paragraph style  <Style name> was not mapping to the TOC style <Root Style Group name : Child style group name : ...... : Style name> and my TOC styles were not correctly mapping.

I wrote a fix for this in my app, by fetching parent groups and appending to a string - which i check in the TOC style entries.

Before calling this a FIX, I need to confirm if there are any more hierarchies/represnetations that could be used to represent a Paragraph Style as a TOC style? I don't want to see that a week later I discover something like <Style : Nested paragraph style> as a TOC style and then I'd have to fix my fix!

Thanks.

TOPICS
Scripting
1.6K
Translate
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 03, 2013 May 03, 2013

Moved from general discussions to the scripting forum...

Translate
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 ,
May 03, 2013 May 03, 2013

Hi,

If YourPara is a paragraph style in myDoc and defined inside group of styles named myStGroup

you can refer to it using:

myDoc.paragraphStyleGroups.item("myStGroup").paragraphStyles.item("YourPara");

Jarek

Translate
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
New Here ,
May 03, 2013 May 03, 2013

Actually, I'm reading a style and checking if it is a TOC style.

TOC style entries are made up in this hierarchical way while Parastyle is independent - as I had explained in the question.

So, before comparing i'm ensuring that I read the style group values too, append it with the parastyle value and then compare with TOC styles.

I just wanted to confirm if this is a complete fix, or am I still missing a case.

Translate
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 ,
May 03, 2013 May 03, 2013
LATEST

Hi,

TOC_style and para_style differ and you can not compare them.

You could check if particular paraStyle is used as one of TOC_style or TOC_styleEntry properties, i.e.:

tocStyle.titleStyle

or

tocStyleEntry.formatStyle

A hierarchy of tocStyleEntries doesn't affect applied (used) paraStyle's names, I am preety sure.

Jarek

Translate
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