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

How do I clear cell attributes not defined by a cell style in InDesign CS5?

Explorer ,
Dec 04, 2016 Dec 04, 2016

Copy link to clipboard

Copied

I am writing a script in vbs for InDesign CS5 in Windows, and cannot find how to clear cell attributes not defined by a cell style in a table. I need this when importing tables from MS Word.

TOPICS
Scripting

Views

687

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

Copy link to clipboard

Copied

Hi,

could you give an example for what you like to do? A simple case?

To what values should the undefined property/value pairs in the cell styles are cleared to?


The following thread is about ExtendScript's clearCellStyleOverrides() method, though.

Maybe not exactly what you want, but could be helpful perhaps.

How to break link to cell/table style in a selection

creativejoan0425 Dec 14, 2013

How to break link to cell/table style in a selection

Especially Marc Autret's post in the same thread here:

Re: How to break link to cell/table style in a selection

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
LEGEND ,
Dec 04, 2016 Dec 04, 2016

Copy link to clipboard

Copied

Hi Uwe,

[JS] to make Tables really "pure"!

Thanks for your comments! 

At the beginning: All kind of situations

Capture d’écran 2016-12-04 à 14.47.02.png

First approach: the op keeps the cell styles manually applied but, now, really pure!

(the "yellow" cell in the first table was a "red" cell!)

Capture d’écran 2016-12-04 à 14.47.14.png

app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.FAST_ENTIRE_SCRIPT, "Pure Tables! …"); 

 

function main() 

{

   

   var  myDoc = app.activeDocument, 

        myCells = myDoc.textFrames.everyItem().tables.everyItem().cells.everyItem().getElements(), 

        C = myCells.length; 

        while( C-- )

            {

                myCells.clearCellStyleOverrides();

                myCells.texts[0].clearOverrides();

            }  

}

Second approach: Totally "pure" tables!

Capture d’écran 2016-12-04 à 14.47.31.png

app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.FAST_ENTIRE_SCRIPT, "Pure Tables! …"); 

 

function main() 

{

   

var  myDoc = app.activeDocument, 

     myCells = myDoc.textFrames.everyItem().tables.everyItem().cells.everyItem().getElements(), 

     C = myCells.length; 

        while( C-- )

            {

                myCells.clearCellStyleOverrides();

                myCells.appliedCellStyle = "[None]";

                myCells.texts[0].clearOverrides();

            }  

}

(^/)

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
Explorer ,
Dec 06, 2016 Dec 06, 2016

Copy link to clipboard

Copied

I am working with text imported from Microsoft Word, and the top and bottom cell insets in a table are zero. I apply a cell style with top and bottom cell insets of 5 pt, but nothing happens to them until I click the 'clear attributes not defined by style' button at the foot of the cell styles panel. Then the insets are applied.

I would like to incorporate this step in a script.

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
Explorer ,
Dec 06, 2016 Dec 06, 2016

Copy link to clipboard

Copied

I should add that I am working with Visual Basic, so find the discussion in javascript a bit difficult.

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
Explorer ,
Dec 06, 2016 Dec 06, 2016

Copy link to clipboard

Copied

LATEST

With a little experimenting, I have now solved the problem. Thanks Obi-Wan and Laubender .

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