hello,
i have a big table of thousands lines and i have to delete the blank row
How do i this ?
thanks
Axel
You need to select a Table, and then select a row in the table, and apply remove();
//myTable --> [table object]
n=0 // index of rows in the table
myTable.rows[n].remove();
You can try this example . Insert the mouse in the table cell or select a cell or row and then click on the script . this script remove the first row of a table if the selection is inside a table.
selection = app.selection[0].parent;
if(selection.toString() == "[object Table]")
selection.rows[0].remove();
else if(selection.parent.toString() == "[object Table]")
selection.parent.rows[0].remove();
Hi Axel,
Please try the below JS code.
First you have to select the entire table and then run the script. This script will delte the row if the the words count is 0.
Note: If, your table have any space in the any cells this script will not delete.
var myTable = app.selection[0].parent.tables[0];
for(i=myTable.rows.length-1; i>=0; i--){
if(myTable.rows[i].cells.everyItem().words.length==0){
//If you need select the row use the below line
myTable.rows[i].select();
//If you need to delete the blank row use the below line.
myTable.rows[i].remove();
}
}
thx
csm_phil
North America
Europe, Middle East and Africa
Asia Pacific