Skip to main content
JK_Argo
Known Participant
July 6, 2026
Answered

Controlling the paragraph style that an inline table is placed within

  • July 6, 2026
  • 2 replies
  • 30 views

Hi. When inserting a table within a text frame, is there any way to ensure that the para style that the table is inserted into is always a particular style?

For example, I have two para styles – Style A and Style B. Is there a way that I can ensure that an inserted table is always inserted into a Style B para, automatically? So the “container” para style, if you will, will always be Style B?

Hope that makes sense!

Thanks in advance.

    Correct answer rob day

    Hi ​@JK_Argo , If checking the tables is taking a lot of time, setting the paragraph style of the paragraphs containing the tables can be scripted—here’s an example:

     

    //all the documents tables
    var t = app.documents[0].stories.everyItem().tables.everyItem().getElements()

    //get a paragraph style named "Your Style B"—edit to the actual name
    var ps = app.documents[0].paragraphStyles.itemByName("Your Style B")

    if (ps.isValid) {
    for (var i = 0; i < t.length; i++){
    t[i].storyOffset.appliedParagraphStyle = ps
    }
    }

     

    2 replies

    rob day
    Community Expert
    rob dayCommunity ExpertCorrect answer
    Community Expert
    July 7, 2026

    Hi ​@JK_Argo , If checking the tables is taking a lot of time, setting the paragraph style of the paragraphs containing the tables can be scripted—here’s an example:

     

    //all the documents tables
    var t = app.documents[0].stories.everyItem().tables.everyItem().getElements()

    //get a paragraph style named "Your Style B"—edit to the actual name
    var ps = app.documents[0].paragraphStyles.itemByName("Your Style B")

    if (ps.isValid) {
    for (var i = 0; i < t.length; i++){
    t[i].storyOffset.appliedParagraphStyle = ps
    }
    }

     

    JK_Argo
    JK_ArgoAuthor
    Known Participant
    July 7, 2026

    Hey ​@rob day. This is perfect. Worked like a charm. Thanks so much.

    Dave Creamer of IDEAS
    Community Expert
    Community Expert
    July 6, 2026

    Is the table in a standalone text frame? If so, an Object Style would do that. You could also use a Library item to drag out preformatted. 

    Otherwise, you can assign a keyboard shortcut to Style B before inserting. 

    David Creamer: Community Expert (ACI and ACE 1995-2023)
    JK_Argo
    JK_ArgoAuthor
    Known Participant
    July 7, 2026

    Hi Dave. Thanks for the response.

    I’m working on long type-setting documents, so the tables would be inserted into a long chain of linked text frames mostly containing a couple of different body para styles. I am currently manually changing the para style before inserting my tables, so your suggestion of using the keyboard shortcut makes sense for that approach.

    It’s just that on one or two occasions I’ve forgotten to change the style first and spent time puzzling over why things like the “space after” doesn’t look consistent with other tables.

    Thanks for your suggestions. Much appreciated.