0
Community Beginner
,
/t5/indesign-discussions/change-toc-font-size-and-line-spacing-using-javascript/td-p/14849983
Sep 09, 2024
Sep 09, 2024
Copy link to clipboard
Copied
I'm using InDesign CS5.5 and the ExtendScript Toolkit 4.1.28
I want to change the color, size and line spacing of a ToC after the update
I used
var toc = ... // my Story
toc.textContainers[0].select()
app.menuActions.item("$ID/UpdateTableOfContentsCmd").invoke();
toc.texts[0].fillColor = "Black"; // it Works
toc.texts[0].appliedParagraphStyle.pointSize = 7; // applied only to the first row
var parStyle = toc.texts[0].appliedParagraphStyle;
parStyle.pointSize = 7;
toc.texts[0].applyParagraphStyle(parStyle); // Applied to all, but the entire style including underline and so on, not only the font size
var paragraphs = toc.paragraphs
for (var i = 0 ; i < paragraphs.length; i++ ) {
paragraphs[i].appliedParagraphStyle.pointSize = 7; // not working
}
How can I set the font size and the line spacint to the entire object? (title + ToC)
Manually i enter in the textBox, I click Ctrl+A (Select ALL) and I use the two forms as shown
Thanks
TOPICS
Scripting
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Community Expert
,
Sep 09, 2024
Sep 09, 2024
Hi @giovanni_4827 ,
use properties of the story:
// Variable toc is holding a story object:
toc.pointSize = 7;
toc.leading = Leading.AUTO;
toc.fillColor = "Black";
See: https://www.indesignjs.de/extendscriptAPI/indesign8/#Story.html
Regards,
Uwe Laubender
( Adobe Community Expert )
Community Expert
,
LATEST
/t5/indesign-discussions/change-toc-font-size-and-line-spacing-using-javascript/m-p/14850038#M588330
Sep 09, 2024
Sep 09, 2024
Copy link to clipboard
Copied
Hi @giovanni_4827 ,
use properties of the story:
// Variable toc is holding a story object:
toc.pointSize = 7;
toc.leading = Leading.AUTO;
toc.fillColor = "Black";
See: https://www.indesignjs.de/extendscriptAPI/indesign8/#Story.html
Regards,
Uwe Laubender
( Adobe Community Expert )
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

