4 Replies Latest reply on Dec 31, 2014 9:20 AM by VeluVK

    Empty row

    VeluVK Level 1

      Hi,

       

      anyone please provide script for the below requirement.

       

      All tables 'first empty row' should be a "TCH" style.

       

       

      Regards,

      Velu

        • 1. Re: Empty row
          Chinnadk Level 4

          Hi Velu,

           

          Try this,

           

          var doc = app.activeDocument,
              _stories = doc.stories.everyItem().getElements();
             
          for(var s=0;s<_stories.length;s++)
          {
                  var _tables = _stories[s].tables.everyItem().getElements();
                  for(var i=0;<_tables.length;i++)
                  {
                          var _rows = _tables[i].rows.everyItem().getElements();
                          for(var j=0;j<_rows.length;j++)
                          {
                                  var _cells = _rows[j].cells.everyItem().getElements();
                                  var con = "";
                                  for(var k=0;k<_cells.length;k++)
                                  {
                                          con += _cells[k].contents;
                                      }
                                  if(con == "")
                                  {
                                          for(var k=0;k<_cells.length;k++)
                                          {
                                                  _cells[k].appliedCellStyle = doc.cellStyles.item("TCH");
                                              }                       
                                          break;
                                      }
                              }
                      }   
              }
          
          

           

          Regards,

          Chinna

          • 2. Re: Empty row
            VeluVK Level 1

            Hi Chinna,

             

            While running the script the below error showing..

             

            Regards,

            Velu

            • 3. Re: Empty row
              VeluVK Level 1

              Hi Chinna,

               

              I got it.

               

              'i' Missed out in the 7th line

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


              Thanks for the script, It working fine.


              Regards,

              Velu

              • 4. Re: Empty row
                VeluVK Level 1

                Hi Chinna,

                 

                Please provide me line for how to delete the first empty rows in all tables.

                 

                 

                Regards,

                Velu