Skip to main content
dublove
Legend
August 21, 2026
Answered

Where is the script code for these options in the tab?

  • August 21, 2026
  • 2 replies
  • 33 views

I couldn't find these settings here.

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#TabStop.html
Clear all
Delete tab
Copy tab again
Reset indentation

I don't want to use the 'clearOverrides' option below, I'm worried it might clear some settings that need to be kept.
texts[0].clearOverrides(OverrideType.ALL);

Thank you very much

    Correct answer rob day

    Use add.tabStops() to create tab stops—Keep in mind the text may or may not have tab characters:

     

    //the first paragraph of the first story
    var p = app.activeDocument.stories[0].paragraphs[0]
    alert("Paragraph has " + p.tabStops.length + " tab stops")

    //add 3 tab stops — NOTE the text may or may not have tab characters
    var tab1 = p.tabStops.add({position:".75 in", alignment:TabStopAlignment.LEFT_ALIGN})
    var tab2 = p.tabStops.add({position:"1.5 in", alignment:TabStopAlignment.LEFT_ALIGN})
    var tab3 = p.tabStops.add({position:"2.5 in", alignment:TabStopAlignment.LEFT_ALIGN})

    //alert("Paragraph has " + p.tabStops.length + " tab stops")

     

     

     

     

    Use remove() to remove stops. This removes all of the paragraph’s stops

     

    p.tabStops.everyItem().remove()

     

    This removes only the first stop:

     

    //Removes the first tab stop
    p.tabStops[0].remove()

     

    Also, if you want to start with no tab stops and 0 indents then before adding the tab stops:

     

    var p = app.activeDocument.stories[0].paragraphs[0]
    p.tabStops.everyItem().remove()
    p.leftIndent ="0 in"
    p.firstLineIndent = "0 in"

     

    2 replies

    dublove
    dubloveAuthor
    Legend
    August 22, 2026

    Hi rob day.

    This is it:

    p.tabStops.everyItem().remove()。

    Thank you very much for adding so many knowledge points.

    rob day
    Community Expert
    rob dayCommunity ExpertCorrect answer
    Community Expert
    August 21, 2026

    Use add.tabStops() to create tab stops—Keep in mind the text may or may not have tab characters:

     

    //the first paragraph of the first story
    var p = app.activeDocument.stories[0].paragraphs[0]
    alert("Paragraph has " + p.tabStops.length + " tab stops")

    //add 3 tab stops — NOTE the text may or may not have tab characters
    var tab1 = p.tabStops.add({position:".75 in", alignment:TabStopAlignment.LEFT_ALIGN})
    var tab2 = p.tabStops.add({position:"1.5 in", alignment:TabStopAlignment.LEFT_ALIGN})
    var tab3 = p.tabStops.add({position:"2.5 in", alignment:TabStopAlignment.LEFT_ALIGN})

    //alert("Paragraph has " + p.tabStops.length + " tab stops")

     

     

     

     

    Use remove() to remove stops. This removes all of the paragraph’s stops

     

    p.tabStops.everyItem().remove()

     

    This removes only the first stop:

     

    //Removes the first tab stop
    p.tabStops[0].remove()

     

    Also, if you want to start with no tab stops and 0 indents then before adding the tab stops:

     

    var p = app.activeDocument.stories[0].paragraphs[0]
    p.tabStops.everyItem().remove()
    p.leftIndent ="0 in"
    p.firstLineIndent = "0 in"