Skip to main content
Inspiring
May 13, 2014
Answered

Create 'Table Cell Style' by script

  • May 13, 2014
  • 1 reply
  • 766 views

Hi,

I want to check Table cell style was created in indesign? If not created I have to create the cell style name with dummy propeties as like 'TBL_COLH' 'TBL_BODY' (This is cell style name).

1. If the 'TBL_COLH' & 'TBL_BODY' this cell style appeared in Indesign, give me alert 'The cell style already presented in Indesign.

2. If the 'TBL_COLH' & 'TBL_BODY' this cell style not appeared in Indesign, I have to create cell style with dummy properites.

Is this possible by script?

by

Hasvi

Correct answer Chinnadk

Hi Hasvi,

Yes, possible. Here it is.

var doc = app.activeDocument;

var array = ["TBL_COLH", "TBL_BODY"];

for(var i=0;i<array.length;i++)

{

    try{

        doc.cellStyles.add({name:array});

        }

    catch(e)

    {

                alert("'" + array + "'" + "already exists in the document.")

        }

    }

Regards,

Chinna

1 reply

Chinnadk
ChinnadkCorrect answer
Legend
May 13, 2014

Hi Hasvi,

Yes, possible. Here it is.

var doc = app.activeDocument;

var array = ["TBL_COLH", "TBL_BODY"];

for(var i=0;i<array.length;i++)

{

    try{

        doc.cellStyles.add({name:array});

        }

    catch(e)

    {

                alert("'" + array + "'" + "already exists in the document.")

        }

    }

Regards,

Chinna

hasviAuthor
Inspiring
May 13, 2014

Hi Chinna,

Thanks a lot for your wonderful work.

by

hasvi