Skip to main content
Participant
October 25, 2017
Question

Script to set table outline thickness, colour and internal line thickness and colour

  • October 25, 2017
  • 1 reply
  • 1537 views

Hello,

I am running Adobe InDesign CC on a MAC

I have about 200 tables in an indesign document.

Due to many changes over many weeks, by several people i am having to go through each table individually to confirm/correct formatting issues.

I need to apply/overwrite:

  1. Outline border line thickness and colour (outline .5 point, colour X)
  2. Internal line thickness and colour (line thickness .25pt, colour X)
  3. alternating background colour (alternate between 'no fill' and colour x)

I have tried to set a style but it offers inconsistent results.

I have search around but obviously being quite a specific request I have found nothing.

Is this an easy task for someone familiar with scripting?  If so could someone help me please?

I can provide a sample table.

Regards Don

This topic has been closed for replies.

1 reply

Liphou
Inspiring
October 25, 2017

Hello, my basic script when I started working on the tables, it is a good base (it dates from 2011)

Bonjour voici, mon script de base quand j'ai commencé à travailler sur les tableaux, c'est une bonne base (il date de 2011)

main();

function main(){

   

    if(app.documents.length != 0){

        if(app.selection.length != 0 && app.selection[0].constructor.name == 'Table'){

               

                var nomTableau = app.selection[0];

               

            leTableauGG(nomTableau);

                exit();           

            }

        else{

                    alert("Selection un tableau");

                    exit();

                }

        }

    else{

        alert("Ouvrait un document et Mettre son cuseur dans le points de départ");

        exit();

    }

//

}//

//

function leTableauGG(leTableau){

        //$.write (leTableau.cells.length);

        // configuratiuon de toutes celu

                with (leTableau.cells.everyItem()){

                        topEdgeStrokeWeight = 0.5; bottomEdgeStrokeWeight = 0.5;

                        leftEdgeStrokeWeight = 0.5; rightEdgeStrokeWeight = 0.5;

                        topInset = '2mm' ; bottomInset = '2mm' ;

                        leftInset = '2mm' ; rightInset = '2mm' ;

                        texts[0].appliedParagraphStyle = 'Tableau centré';

                    } /// with

               

                 with (leTableau.columns[0]) {

                    width = '55mm'; //largeur

                    //texts[0].appliedParagraphStyle = 'Tableau marge';

                     cells.everyItem().texts[0].appliedParagraphStyle = 'Tableau marge';

                   }

  // ligne 01              

                 with ( leTableau.rows[0]){

                        topInset = '0' ; bottomInset = '3mm' ;

                        leftInset = '1mm' ; rightInset = '1mm' ;

                        topEdgeStrokeWeight= '0.0 pt';

                        leftEdgeStrokeWeight= '0.0 pt'; rightEdgeStrokeWeight= '0.0 pt';

                        //

                        cells.everyItem().appliedCellStyle= 'Tableau Titre';

                        cells[0].texts[0].appliedParagraphStyle = 'Tableau Titre';

                     

                } // with

           

          

               with (leTableau.rows[1]) {

                    cells.everyItem().texts[0].appliedParagraphStyle = 'Tableau centré';

                   

                        height = '34mm';

                   }

              

        

              

              

            for (i = 1;  i < leTableau.columns.length-1; i++){

        

                leTableau.columns.width = '13mm'; //largeur

       

            }

        leTableau.columns[leTableau.columns.length-1].width = '25mm'; //largeur

    }// fin function  leTableauGG

Philippe

Liphou
Inspiring
October 25, 2017

Autre exemple

with (nomTableau.rows[1]) {

                                fillColor = 'Noir30' ;

                                bottomEdgeStrokeColor = 'Noir00';

                                bottomEdgeStrokeWeight= '1.0 pt';

                                height = '4 mm';

                                maximumHeight = '4 mm';

                                topInset = '0 mm' ;

                                    bottomInset = '0 mm' ;

                                verticalJustification = VerticalJustification.centerAlign;

                                //appliedParagraphStyle = 'Contact';

                            }// fin With