Skip to main content
Community Expert
June 7, 2019
Answered

Styleoverriden returns wrong value for AutoLeading override

  • June 7, 2019
  • 2 replies
  • 1250 views

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

This topic has been closed for replies.
Correct answer BarlaeDC

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)

2 replies

BarlaeDC
Community Expert
BarlaeDCCommunity ExpertCorrect answer
Community Expert
June 7, 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 as overrides or not (Optional)

(default: true)

Community Expert
June 7, 2019

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

Community Expert
June 7, 2019

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

Community Expert
June 7, 2019

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

-Manan

-Manan
Community Expert
June 7, 2019

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