Copy link to clipboard
Copied
I want to add a paragraph after every table in my document, i was able to insert it before tables with this script but couldn't figure out how to insert it after tables, any help?
var tables = app.activeDocument.stories.everyItem().tables.everyItem().storyOffset
for (var i = 0; i < tables.length; i++) {
tables[i].contents = "\r";
}
Hi @ali u , Also if you want to add a paragraph after try this:
var ip = app.activeDocument.stories.everyItem().tables.everyItem().storyOffset;
var nl;
for (var i = 0; i < ip.length; i++) {
nl = ip[i].index + 1
ip[i].parent.insertionPoints[nl].contents = "\r";
}
Copy link to clipboard
Copied
I would apply a paragraph style with correct Space Before and Space After settings to the story offset insertion point.
app.activeDocument.stories.everyItem().tables.everyItem().storyOffset
for (var i = 0; i < tables.length; i++) {
tables[i].applyParagraphStyle("nameofsryle");
}
Copy link to clipboard
Copied
Hi @ali u , Also if you want to add a paragraph after try this:
var ip = app.activeDocument.stories.everyItem().tables.everyItem().storyOffset;
var nl;
for (var i = 0; i < ip.length; i++) {
nl = ip[i].index + 1
ip[i].parent.insertionPoints[nl].contents = "\r";
}
Copy link to clipboard
Copied
Thank you very much!