Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 97529

Delete entire row if any cell is blank

$
0
0

Hi all

 

I have found this script and it works perfectly for its purposes (if an entire row has no data/length, then remove it).

 

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].contents != "") myContents++;

                }

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

            }

        }

    }

 

However, in the first column of my table, I have some text, and in the second column, I have no data.

 

How do I delete an entire row (including the first column containing text) using a script if just one cell of the row is blank?

I like the above script as I don't have to enter a table to run it - i.e. it will just apply to the whole document as I have many pages...

 

Thanks!


Viewing all articles
Browse latest Browse all 97529

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>