Skip to main content
dublove
Legend
Aug 21, 2026 4:26 PM UTC
Answered

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

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

    rob day
    rob dayCorrect answer
    Community Expert
    Aug 21, 2026 9:54 PM UTC

    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
    Aug 22, 2026 5:17 AM UTC

    Hi rob day.

    This is it:

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

    Thank you very much for adding so many knowledge points.

    Translate
    rob day
    Community Expert
    rob dayCommunity ExpertCorrect answer
    Community Expert
    Aug 21, 2026 9:54 PM UTC

    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"

     

    Translate