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

how to alert user for overridden CellStyle in indesign using javascript

Engaged ,
Mar 29, 2023 Mar 29, 2023

Copy link to clipboard

Copied

I tried but there is only way to clearCellOverrides but I don't  see any method to point CellOverrides. Help me with this point!

TOPICS
How to , Scripting

Views

640

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

Engaged , Apr 22, 2023 Apr 22, 2023
  var tables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
  for (var j = 0; j < tables.length; j++) {
    var cells = tables[j].cells.everyItem().getElements();
    for (var k = 0; k < cells.length; k++) {
          cells[k].select();
           var clearOverridesCmd = app.menuActions.itemByID(132128);
            if (clearOverridesCmd.enabled) {            
                  var OverCellObject = {
                  cellContent:  cells[k].contents,
                 
...

Votes

Translate

Translate
Engaged ,
Mar 31, 2023 Mar 31, 2023

Copy link to clipboard

Copied

is there anyway to indicate cellOverrides is present in document??

 

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 ,
Apr 01, 2023 Apr 01, 2023

Copy link to clipboard

Copied

--

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 ,
Mar 31, 2023 Mar 31, 2023

Copy link to clipboard

Copied

This script alerts you when there are overset cells in a document:

if (app.documents[0].stories.everyItem()
   .tables.everyItem()
   .cells.everyItem()
   .overflows.join('').indexOf('true') >= 0) {
      alert ('There are overset cells in the document.');
}

I know what your next question will be.

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 ,
Mar 31, 2023 Mar 31, 2023

Copy link to clipboard

Copied

Hi Peter,

The OP asked for cellstyle override you alerted overset. So as you mentioned you already know the question, please be kind enough to explain it 🙂

-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 ,
Apr 01, 2023 Apr 01, 2023

Copy link to clipboard

Copied

Aha -- thanks, @Manan Joshi  I misread that. Well, finding (cell) style overrides isn't so easy. Text-style overrides can be displayed, but to collect cells with overridden style isn't so easy.

 

Instead of checking whether there are style overrides, maybe clear all overrides. Is that a possibility?

 

P.

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 ,
Apr 02, 2023 Apr 02, 2023

Copy link to clipboard

Copied

Thanks for confirming @Peter Kahrel, to be honest I was expecting that you would pull out a rabbit from your hat and I would be amazed as always. With this cleared out we need to see what the OP is after, only that would tell us if clearing the overrides would work or not. Another trick that I used in the past for paragraph/character styles is to export the tagged text and then parse it to find the properties that had the overrides applied over it. Not sure if it would work with cell styles, probably not but that remains to be seen.

-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
Engaged ,
Apr 22, 2023 Apr 22, 2023

Copy link to clipboard

Copied

  var tables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
  for (var j = 0; j < tables.length; j++) {
    var cells = tables[j].cells.everyItem().getElements();
    for (var k = 0; k < cells.length; k++) {
          cells[k].select();
           var clearOverridesCmd = app.menuActions.itemByID(132128);
            if (clearOverridesCmd.enabled) {            
                  var OverCellObject = {
                  cellContent:  cells[k].contents,
                  CellpageNo: cells[k].parent.parent.parentPage.name,
                  cellStyleName:  cells[k].appliedCellStyle.name
                };
             myCellOverrides.push(OverCellObject);
            } 
    }
  }

I tried like this and it was working fine for me! Thanks for your response and efforts @Peter Kahrel and @Manan Joshi 

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 ,
Apr 26, 2023 Apr 26, 2023

Copy link to clipboard

Copied

Very clever, @Karthik SG .

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
Engaged ,
May 11, 2023 May 11, 2023

Copy link to clipboard

Copied

LATEST

Thanks @Peter Kahrel 

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