Skip to main content
dublove
Legend
June 1, 2026
質問

Is there a quick way to duplicate an “Contents Style” exactly?

Hi everyone.

Every time I need to create an index manually, I rename the “Contents Style” to “Index Style,” save the original ID file (e.g., A.indd) as B.indd, then open the A.indd file and load B.indd in “Contents Styles” panel.
This gives me two identical contents Styles.

It’s a bit of a hassle.
Is there a way to directly copy an identical Table of Contents Style?

 

    返信数 1

    Community Expert
    June 1, 2026

    TOCStyle.duplicate() is exposed in the scripting

    But it’s not in the UI - interesting

     

    // Edit these two values if your style names are different.
    var findName = "Contents";
    var newName = "Index";

    var doc = app.activeDocument;
    var source = doc.tocStyles.itemByName(findName);

    if (!source.isValid) {
    alert("No matching TOC style found.");
    } else {
    var copy = source.duplicate();
    copy.name = newName;
    alert("Copied \"" + findName + "\" to \"" + newName + "\".");
    }