Copy link to clipboard
Copied
Hi everyone,
From this old post, I've learned that it's possible to create a cross-reference to paragraph via script. My question now is: Is there a way to also define/edit it via script? - see screenshot below. For instance, I would like to remove the quotations marks and leave only <paraText /> when creating the cross-reference. @Peter Kahrel, any help will be greatly appreciated 🙂 Thanks!
Copy link to clipboard
Copied
You can start here:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#CrossReference.html
Then this should be useful as well:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#BuildingBlock.html#d1e122138
Copy link to clipboard
Copied
@Rogerio5C09 -- The thing with editing cross-refernce formats is that you can't remove individual items: you have to remove all parts, then add what you want:
cr = app.activeDocument.crossReferenceFormats.item ('Paragraph Text');
// Can't remove the lot using everyItem().remove(),
// so you have to remove each item separately
for (i = cr.buildingBlocks.length-1; i >= 0; i--) {
cr.buildingBlocks[i].remove();
}
// Add the desired building block
cr.buildingBlocks.add (BuildingBlockTypes.PARAGRAPH_TEXT_BUILDING_BLOCK);