[JS] clearOverrides() how to specify only paragraph overrides?

Participant ,
Nov 23, 2020 Nov 23, 2020

Copy link to clipboard

Copied

Hi All,

 

My InDesign document have one story and one paragraph. e.g "Hello world.. have a nice day"

Now I had applied a para style say 'myPara' to paragraph.

Now I select entire para and changed its font-size to 24px to make paragraph override.

 

Now I want to clear this paragrap override I tried the api

clearOverrides(OverrideType.PARAGRAPH_ONLY) but this won't work.

if call the api with default argument which is clearOverrides(OverrideType.ALL) then it works.

but only needs to remove the paragraph override and intact the character overrides.

 

Regards,

Alam

 

Regards,

Alam

TOPICS
Scripting

Views

117

Likes

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
Adobe Community Professional ,
Nov 23, 2020 Nov 23, 2020

Copy link to clipboard

Copied

It seems to be identifying this as a character override and hence the following seems to work

clearOverrides(OverrideType.CHARACTER_ONLY)

Why this is so, I am also confused

-Manan

Likes

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
Participant ,
Nov 23, 2020 Nov 23, 2020

Copy link to clipboard

Copied

Hi Manan,

 

Thanks for your quick relpy, yes with passing argument OverrideType.CHARACTER_ONLY will clear the override but it also clear the character overrides whereas I wants character overrides intact.

 

Regars,

Alam

Likes

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
Adobe Community Professional ,
Nov 23, 2020 Nov 23, 2020

Copy link to clipboard

Copied

Hi alam_84,
I'm a bit confused now. Just to make that clear:

 

To change the point size is a character override. That the override is in every character of a paragraph makes no difference. It's still a character override. You can check that when you turn on the Style Override Highlighter as I did in the screenshot below.

 

One can consider all overrides to properties that can be applied to a single character as character overrides.

That said: Exceptions are the properties like appliedParagraphStyle, composer or justification etc.pp. that work for whole paragraphs only. The exceptions can be applied by scripting to a range of characters, but they cannot be applied with the Characters panel or the Character Styles panel.

 

Paragraph-vs-Character-Overrides.PNG

Regards,
Uwe Laubender

( ACP )

Likes

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
Adobe Community Professional ,
Nov 23, 2020 Nov 23, 2020

Copy link to clipboard

Copied

Uwe explained why this is not working as you might think. If point size is the only concern, you can reset a text's point size to the applied paragraph styles point size, ie: app.selection[0].pointSize = app.selection[0].appliedParagraphStyle.pointSize;

Likes

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
Participant ,
Nov 23, 2020 Nov 23, 2020

Copy link to clipboard

Copied

Hi All,

 

Thanks for all the reply.

 

My only concern is not the pointSize it is about why api clearOverrides(OverrideType.PARAGRAPH_ONLY) does not work when I want to remove paragraph overrides.

 

Please Went through the followings attachments

step1.png

step2.png

 

As you can see that in step one character style bold has family and style.

and in step2 when I change the font size then it shows override in paragraph style panel.

if point-size is a character style attribute then why it does not shows as overrides in character style panel.

 

Hope all of you understand my problem.

 

Moreover do we have any mechanism or api which tells me that override on textstylerange have character override or paragraph override.

Likes

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
Adobe Community Professional ,
Nov 23, 2020 Nov 23, 2020

Copy link to clipboard

Copied

You could always just reapply the paragraphStyle and clear overrides on that reapplication: 

someTextRange.applyParagraphStyle(someTextRange.appliedParagraphStyle, true);

I would agree with the general sentiment that it is unintuitive...like many things with ES, unfortunately.  

Likes

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
Adobe Community Professional ,
Nov 23, 2020 Nov 23, 2020

Copy link to clipboard

Copied

Hi Alam,

the paragraph style name in the Paragraph Styles panel shows a + for any overrides.

Not only paragraph overrides ( e.g. you do define also point size with a paragraph style so if there is an override with point size the + sign will show up ).

 

A character style name in the Character Styles panel will only indicate overrides, the +  sign, if you override one of the applied properties that is defined in that style. For example: If you defined one property only in a character style, let's say the fill color of a character, the + sign will not show up, if you change the point size. Why? Because a specific point size is not defined in that character style.

 

Regards,
Uwe Laubender

( ACP )

Likes

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
Participant ,
Nov 23, 2020 Nov 23, 2020

Copy link to clipboard

Copied

LATEST

Yes I observed same behaviour then how we can identify using script api or code that partiular override is a character or paragraph override.

Likes

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