Reply To: Delete empty cells from Data Merge via JS

Home Page / Forums / General InDesign Topics (CLOSED) / Delete empty cells from Data Merge via JS / Reply To: Delete empty cells from Data Merge via JS

#53283
Anonymous
Inactive

Hey Jongware,

Thanks for your response.

I've got to say I'm getting hooked on this scripting. Before I made this document I have never used it before. Suddenly my script palette is filling up and I can make text-heavy documents in no time at all.

I updated the script as discussed above. The document didn't crash, but the cells didn't delete either. I did get a spinning beachball for a minute or so, suggesting it was doing something, but no real results I can see.

Here is a screen shot of the cells:

I can remove the cells with content like “Email: ” by searching for those via the following script. You will notice that the 'empty cell has a placeholder which is an empty Cell from excel. Is there a way I can search for that expression in GREP? I am not sure how to express it in GREP though:

// JavaScript Document
app.findGrepPreferences = null;
app.findGrepPreferences.findWhat = “Email:+\Z“;
empties = app.activeDocument.findGrep(true);
for (i = 0; i < empties.length; i++)
   if (empties[i].parent instanceof Cell)
      empties[i].parent.parentRow.remove();

Do you know how I can change the expression for the values that appear in the empty cells?

Thanks in advance, really appreciate your help.

This article was last modified on July 1, 2010

Comments (0)

Loading comments...