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

Styleoverriden returns wrong value for AutoLeading override

Community Expert ,
Jun 06, 2019 Jun 06, 2019

Copy link to clipboard

Copied

Hello All,

I am checking text for style overrides. Now if a piece of text has a character style applied over it and has an override of auto leading. The styleoverridden property returns false. How do we explain this? Is it a bug or am i missing something?

-Manan

TOPICS
Scripting

Views

554

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 , Jun 07, 2019 Jun 07, 2019

Hi,

Could you not use textHasOverrides, as this takes a paragraph or character style.

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Character.html#d1e461137__d1e469100

Boolean textHasOverrides (charOrParaStyle:StyleType, [charStyleAsOverride:Boolean=Boolean])

If true, text has local overrides

Parameter

Type

Description

charOrParaStyle

StyleType

StyleType.CHARACTER_STYLE_TYPE

StyleType.PARAGRAPH_STYLE_TYPE

Style type to look at.

charStyleAsOverride

Boolean

Whether to consider character styles

...

Votes

Translate

Translate
Community Expert ,
Jun 07, 2019 Jun 07, 2019

Copy link to clipboard

Copied

Hi Manan,

just tested this and I see that texts[0].styleOverridden returns true.

Do you have a sample document where you are seeing this?

Regards,
Uwe

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 ,
Jun 07, 2019 Jun 07, 2019

Copy link to clipboard

Copied

Hi Uwe,

I get it even on a fresh document that i create. I have tested it on CC2017 MAC and CC2018 WIN. See the video cast i attach below

Auto_Leading.gif

-Manan

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 ,
Jun 07, 2019 Jun 07, 2019

Copy link to clipboard

Copied

My explanation is:

styleOverridden is showing if the paragraph style is overridden.

In your sample the applied character style is overridden.

FWIW: In my test before the paragraph style was overridden.

Regards,
Uwe

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 ,
Jun 07, 2019 Jun 07, 2019

Copy link to clipboard

Copied

Seems the DOM documentation lacks to state that this property will work only for ParagraphStyle overrides.

styleOverridden

Boolean

readonly

If true, the applied style has been overridden with additional attributes.

I tested that if i apply a paragraph style on to it that has leading set to something other than auto and hence has override, i do get the result as true when checking styleOveridden.

Is then there no way to identify the override for the case that i specified?

-Manan

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 ,
Jun 07, 2019 Jun 07, 2019

Copy link to clipboard

Copied

Hi,

Could you not use textHasOverrides, as this takes a paragraph or character style.

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Character.html#d1e461137__d1e469100

Boolean textHasOverrides (charOrParaStyle:StyleType, [charStyleAsOverride:Boolean=Boolean])

If true, text has local overrides

Parameter

Type

Description

charOrParaStyle

StyleType

StyleType.CHARACTER_STYLE_TYPE

StyleType.PARAGRAPH_STYLE_TYPE

Style type to look at.

charStyleAsOverride

Boolean

Whether to consider character styles as overrides or not (Optional)

(default: true)

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 ,
Jun 07, 2019 Jun 07, 2019

Copy link to clipboard

Copied

Hi BarlaeDC ,

thank you very much for this. It seems that method textHasOverrides() was introduced with InDesign version 11.

https://www.indesignjs.de/extendscriptAPI/indesign11/#Text.html#d1e409488

Just testing this 🙂

Regards,
Uwe

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 ,
Jun 07, 2019 Jun 07, 2019

Copy link to clipboard

Copied

Thanks, seems promising, i will test it and update you guys back.

-Manan

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 ,
Jun 07, 2019 Jun 07, 2019

Copy link to clipboard

Copied

Hm. If we follow the DOM discription in InDesign version 11 textHasOverrides() has only one argument:

https://www.indesignjs.de/extendscriptAPI/indesign11/#Text.html#d1e411934__d1e417388

With InDesign version 12, 13 and 14 it has two arguments:

https://www.indesignjs.de/extendscriptAPI/indesign12/#Text.html#d1e446908__d1e454077

Regards,
Uwe

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 ,
Jun 08, 2019 Jun 08, 2019

Copy link to clipboard

Copied

Perfect, it works. Thanks BarlaeDC​ for sharing this API and thanks Laubender​ for pointing out that the styleOveridden works with pstyles.

-Manan

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 ,
Apr 29, 2024 Apr 29, 2024

Copy link to clipboard

Copied

LATEST

@Manan Joshi  @Laubender 

 

I had to investigate in more depth the Text.styleOverridden and Text.textHasOverrides() features for a personal project. These results could complement and qualify some of the information presented here.

 

→ “Private Investigation into Style Overrides” (April 2024)

 

Best,

Marc

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