Copy link to clipboard
Copied
A script (that I found online) that I use regularly doesn't work in a document resulting from a data merge. The script works perfectly in any other regular document.
This is the script, to automatically delete all rows with a specific text ("*"):
var allStories = app.documents[0].stories;
var st = 0;
while(st < allStories.length){
var allTables = allStories[st].tables;
var tbl = 0;
while(tbl < allTables.length){
var allCells = allTables[tbl].cells;
var cel = 0;
while(cel < allCells.length){
if(allCells[cel].contents.toString().toLowerCase().indexOf("*") != -1){
allCells[cel].rows[0].remove();
allCells = allTables[tbl].cells;
cel = -1;
}
cel++;
}
tbl++;
}
st++;
}
And this is the error I get when running it on a data merged document:
Any one know why it's only happening on data merged documents?
Copy link to clipboard
Copied
By the way, the script was found here: https://community.adobe.com/t5/indesign-discussions/indesign-script-to-delete-table-rows-containing-...
Copy link to clipboard
Copied
Could you share a sample .indd file where the script isn't working?