• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Script to insert a paragraph after every table

Explorer ,
Feb 14, 2023 Feb 14, 2023

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";
}

TOPICS
Scripting

Views

437

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 14, 2023 Feb 14, 2023

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";
}

Votes

Translate

Translate
Community Expert ,
Feb 14, 2023 Feb 14, 2023

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");
}

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 14, 2023 Feb 14, 2023

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";
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 14, 2023 Feb 14, 2023

Copy link to clipboard

Copied

LATEST

Thank you very much!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines