2 Replies Latest reply on Mar 13, 2015 6:35 AM by beh_gras_beh

    Tags to ParagraphStyle

    beh_gras_beh

      Dear Indesign users,

       

      Is there an way you can add ParagraphStyles like the XML structure below?

       

      Schermafbeelding 2015-03-13 om 12.19.24.png

       

      Greetings from Holland!

        • 1. Re: Tags to ParagraphStyle
          Loic.Aigon Adobe Community Professional

          Hi,

           

          What do you have in mind exactly ? Do you want to automatically add ParagraphStyles  given XML nodes name ? Or link ParagraphStyles to XML nodes ?

           

          If you want to automatically create paraStyles you can use pStyle attributes in the XML. A XSL file can be used on the fly so your input XML file get enhanced content.

           

          Otherwise it's quite easy to create automatic styles based on xml nodes :

           

          function main() {
            var xes, n, doc, ps, xe;
            if ( !app.documents.length ) return;
            doc = app.activeDocument;
            xes = doc.xmlElements[0].xmlElements;
            n = xes.length;
            while ( n-- ) {
            xe = xes[n];
            st = doc.paragraphStyles.itemByName (xe.markupTag.name );
            !st.isValid && doc.paragraphStyles.add({name:xe.markupTag.name});
            }
          }
          
          
          main();
          

           

           

          HTH,

           

          Loic

          http://www.ozalto.com

          • 2. Re: Tags to ParagraphStyle
            beh_gras_beh Level 1

            Whell, thats it!

             

            As the tags already says, you'r the best!

             

            Greetings!