1 Reply Latest reply on Aug 25, 2012 3:54 AM by Marco Lugli

    Setting stroke weight of adiacent cell

    Marco Lugli Level 1

      Hello,

      I would like to know if there's a way to do this:

      I have a series of tables which have to be formatted in a specific way. Unfortunately, with the table formatting options I'm able to do only a part of these formattings; so the question is: how can I set the stroke weight of a cell border based on an adiacent cell?

      See attached image for explanation

      strokeweight.PNG

      Hope someone can help me!

      Thanks in advance

        • 1. Re: Setting stroke weight of adiacent cell
          Marco Lugli Level 1

          Hi,

          since nobody gave me answer, I answered myself with this JavaScript:

           

          var myDoc = app.activeDocument;

          var totTxtFrames = myDoc.textFrames;

          for(i=0; i<totTxtFrames.length; i++){

              myTxtFrame = totTxtFrames[i];

              totTables = myTxtFrame.tables;

              for(j=0; j<totTables.length; j++){

                  myTable = totTables[j];

                  totRows = myTable.rows;       

                  for(k=0; k<totRows.length; k++){

                      myRow = totRows[k];

                      myRowIndex = myRow.index;

                      totCells = myRow.cells;

                      for(n=0; n<totCells.length; n++){

                              myCell = totCells[n];

                              if(myCell.rowSpan > 1){

                                  myCellSpan = myCell.rowSpan;

                                  if(myCell.bottomEdgeStrokeWeight == 0.5){

                                          totRows.item(myRowIndex + myCellSpan - 1).bottomEdgeStrokeWeight = 0.5;

                                  }

                              }

                              else{

                                  myCellSpan = myCell.rowSpan;

                                  if(myCell.bottomEdgeStrokeWeight == 0.5){

                                          totRows.item(myRowIndex + myCellSpan - 1).bottomEdgeStrokeWeight = 0.5;

                                  }

                              }

                      }

                  }

              }

          }

           

          Hope might help someone with the same problem

          Cheers!