5 Replies Latest reply on Dec 11, 2016 7:20 AM by Obi-wan Kenobi

    Code to be evaluated! [009] Cross-Reference Format! …

    Obi-wan Kenobi Adobe Community Professional

      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:

       

      Capture d’écran 2016-12-10 à 14.12.48.png

       

      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!

       

      (^/)