Answered
separate text from table
Hi; There are hundreds of paintings. Is there a way to separate the table and text with paragraphs? I can't get to the table with grep. Thank you.

Hi; There are hundreds of paintings. Is there a way to separate the table and text with paragraphs? I can't get to the table with grep. Thank you.

Hi @uniq1, try this script. It will add a carriage return after every table that doesn't have one.
- Mark
function main() {
var doc = app.activeDocument,
tables = doc.stories.everyItem().tables.everyItem().getElements(),
counter = 0;
for (var i = tables.length - 1; i >= 0; i--) {
var table = tables[i],
index = table.storyOffset.index;
if (
table.storyOffset.parentStory.characters[index + 1].isValid
&& table.storyOffset.parentStory.characters[index + 1].contents != '\u000D'
) {
table.storyOffset.parentStory.insertionPoints[index + 1].contents = '\u000D';
counter++;
}
}
alert('Added carriage return to ' + counter + ' tables.');
};
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Add carriage return after all tables');
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.