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

Find Cell Style Override?

Community Beginner ,
Nov 29, 2023 Nov 29, 2023

Hi folks,

Is there anyway or method to find out if any cellStyle has been overridden through InDesign JavaScript?

Cell Style Override.png

Thanks

AP

TOPICS
Scripting
1.5K
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

correct answers 1 Correct answer

Participant ,
Nov 29, 2023 Nov 29, 2023

This script by Gregor Fellenz may be useful to you: https://github.com/grefel/clearOverrides

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 ,
Nov 29, 2023 Nov 29, 2023

Do you want to FIND or do you want to just REMOVE overrides? 

 

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 Beginner ,
Nov 29, 2023 Nov 29, 2023

I don't want to clear it.

I want to find out if cell has any cell style override.

Thanks
AP

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
Participant ,
Nov 29, 2023 Nov 29, 2023

The panel "preflight" dont work to you? If you just want to find it, it works for that.

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 Beginner ,
Nov 29, 2023 Nov 29, 2023

I want to find out if any cell has appliedCellStyle override through InDesign JavaScript not manually..

 

Thanks

AP

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 ,
Nov 29, 2023 Nov 29, 2023

It's not so easy - as there is no "overriden" flag - so you'd have to check EVERY property of the Cell... 

 

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 ,
Nov 29, 2023 Nov 29, 2023

This came up earlier this year, and someone had a very clever solution. Unfortunately I can't find that thread now.

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 ,
Nov 29, 2023 Nov 29, 2023

In JS it should be pretty easy - get list of all properties of both objects and compare - JS offers a quick and easy way to do this - but I'm not JS guy...

 

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
Guide ,
Nov 30, 2023 Nov 30, 2023
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 ,
Nov 30, 2023 Nov 30, 2023

@Dirk Becker, but this only returns cells that have overrides - not which property has been overriden?

 

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
Guide ,
Nov 30, 2023 Nov 30, 2023

@Robert at ID-Tasker 

The original request was "find out if any cellStyle has been overridden"

The approach could even work across all cells of each row, or the entire table at once, then nail it down with binary search.

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 ,
Nov 30, 2023 Nov 30, 2023

Yeah, it can be used as a starting point for more detailed "fishing expedition".

 

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 Beginner ,
Dec 03, 2023 Dec 03, 2023

This solution is close so far desktop application scripting. Unfortunetly this will not work in InDesign Server Scripting.
Atleast we have something now for dekstop application atleast.

 

Thanks

AP

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 ,
Dec 04, 2023 Dec 04, 2023

Why not? It doesn't use clipboard so there is no reason why it shouldn't work on IDS? 

 

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 ,
Dec 04, 2023 Dec 04, 2023

InDesign Server doesn't have menus, therefore no menuActions.

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 ,
Dec 04, 2023 Dec 04, 2023

Right... So the only solution is a "brute force" approach - check / compare every property... 

 

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 ,
Dec 04, 2023 Dec 04, 2023

Wait a second... If you are working on a Server - how can you have any kind of overrides?? 

 

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 ,
Dec 04, 2023 Dec 04, 2023

A script 🙂

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 ,
Dec 04, 2023 Dec 04, 2023
quote

A script 🙂


By @Peter Kahrel

 

?? 

 

Are you replying to my question how there can be overrides on IDS ? 

 

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 ,
Dec 04, 2023 Dec 04, 2023

Yes.

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 ,
Dec 04, 2023 Dec 04, 2023

I'm not JS guy at all so maybe I'm barking the wrong tree, but this in Google:

 

"js find differences between two objects" 

 

returns articles about:

 

Lodash _.isEqual() Method

 

https://javascript.plainenglish.io/how-to-get-the-difference-between-two-javascript-objects-e885e093...

 

[...] Calling this with two objects will return an array of the names of keys on the objects whose values are not equal, and also includes the names of keys that do not exist on both objects [...]

 

Or it won't work in the JS version that is used in the InDesign? 

 

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 ,
Dec 04, 2023 Dec 04, 2023

Or JSON.stringify() route... 

 

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 ,
Dec 04, 2023 Dec 04, 2023

_.isEqual() is UXP-only. It works on JavaScript objects such as strings, arrays, and JSON objects, but not on most InDesign objects. For instance, cells have a name, and no two cells have the same name, and therefore _isEqual() always returns false when you compare two cells.

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 ,
Dec 04, 2023 Dec 04, 2023

But the link I've provided says, that it will return list of differences? Not just true / false?

 

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