Copy link to clipboard
Copied
Hi all Scripters,
I've an exasperating issue with the cross-reference format definition in [JS]!
With this code:
var myDoc = app.activeDocument;
var myCRFormat = myDoc.crossReferenceFormats.add ('myTest');
var myCRCharStyle = myDoc.characterStyles.itemByName("Superscript");
myCRFormat.appliedCharacterStyle = myCRCharStyle;
myCRFormat.buildingBlocks.add ({blockType: BuildingBlockTypes.CUSTOM_STRING_BUILDING_BLOCK, customText: '<txtAnchrName/>'});
I get this:
Grrr!!!
Moreover, I find this code not frankly cool to read! Could we add "myCRFormat" directly playing with properties?
Thanks in advance for your comments!
(^/)
Use a named building block for the anchor:
myCRFormat.buildingBlocks.add ({blockType: BuildingBlockTypes.CUSTOM_STRING_BUILDING_BLOCK, customText: 'On this page: '});
myCRFormat.buildingBlocks.add ({blockType: BuildingBlockTypes.BOOKMARK_NAME_BUILDING_BLOCK});
The Adobe chaps got it slightly wron when they used 'Bookmark' when the meant 'Anchor'.
P.
Copy link to clipboard
Copied
Use a named building block for the anchor:
myCRFormat.buildingBlocks.add ({blockType: BuildingBlockTypes.CUSTOM_STRING_BUILDING_BLOCK, customText: 'On this page: '});
myCRFormat.buildingBlocks.add ({blockType: BuildingBlockTypes.BOOKMARK_NAME_BUILDING_BLOCK});
The Adobe chaps got it slightly wron when they used 'Bookmark' when the meant 'Anchor'.
P.
Copy link to clipboard
Copied
Thanks Peter!
The 2nd code line is cool!
(^/)
Copy link to clipboard
Copied
Hi Obi-wan,
so this question here is answered by Peter…
Regards,
Uwe
Copy link to clipboard
Copied
Oups! … Done with pleasure! (^/)
Copy link to clipboard
Copied
Hi Peter,
thank you very much for this.
Maybe with its introduction in CS4 the enumerator should have been named more like:
TEXT_ANCHOR_NAME_BUILDING_BLOCK
( Something like 'bbta' is not used as enumeration yet… )
Regards,
Uwe