0 Replies Latest reply on Nov 26, 2010 6:10 AM by Mac_06

    How to untag empty xml Elements CS4[JS]

    Mac_06 Level 2

      Hi All

       

      I've a script which remove empty row from table but its getting fail when an empty row contains any empty xml tag.

      Could any one suggest the way.

       

      I tried with this :-

       

      var myDocument = app.activeDocument;

       

      for(var i=myDocument.textFrames.length-1; i>=0; i--){

       

          for(var j=myDocument.textFrames[i].tables.length-1; j>=0; j--){

       

              for(var k=myDocument.textFrames[i].tables[j].rows.length-1; k>=0; k--){

       

                  myContents = 0;

       

                  for(var l=myDocument.textFrames[i].tables[j].rows[k].cells.length-1; l>=0; l--){

                          if (myDocument.textFrames[i].tables[j].rows[k].cells[l].character== UNDEFINED){

       

                               myDocument.textFrames[i].tables[j].rows[k].cells[l].associatedXMLElement.untag()

                          }

                      if (myDocument.textFrames[i].tables[j].rows[k].cells[l].contents != "") myContents++;

                      }

                  if (myContents == 0) myDocument.textFrames[i].tables[j].rows[k].remove();

       

                  }

              }

          }

       

      but it doesn't seems to work.

       

      Many Thanks in advance

      Mac