7 Replies Latest reply on May 30, 2016 7:28 AM by Kai Rübsamen

    How to set row type in all the tables?

    vidhyar34646163

      I need to convert first row of all the tables to header row. I tried all the possible ways which are mentioned below, but am getting the error (can't set row type) . After researched about this error I got to know that this is a read only property so can't change row type in a table. How can I fix this?

       

      1.

      var myTables = app.activeDocument.stories.everyItem().tables; 

       

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

          myTables[i].rows.firstItem().rowType = RowTypes.HEADER_ROW; 

      }

       

      2.

        app.activeDocument.stories.everyItem().tables.everyItem().rows[0].rowType=RowTypes.HEADER_ ROW;  

       

      3.

       

      var myRows = app.activeDocument.stories.everyItem().tables.everyItem().rows[0].getElements(), 

            myCells = app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem(), 

            l = myRows.length; 

      while (l--) if (myRows[l].rowType == RowTypes.BODY_ROW) myRows[l].rowType = RowTypes.HEADER_ROW;