3 Replies Latest reply on Feb 4, 2017 11:23 PM by Trevorׅ

    numberingFormat doesn't work!

    uniqued_tol Level 1

      Hi scripters;

       

      for (i = 1; i < myPara.length; i++){ 
      if(myPara[i].bulletsAndNumberingListType == ListType.NUMBERED_LIST)
      

       

      The top code works. But the underlying code does not work. Can someone explain why?

       

      for (i = 1; i < myPara.length; i++){ 
      if(myPara[i].numberingFormat == NumberingStyle.SINGLE_LEADING_ZEROS)
      
      

       

      Thanks

        • 1. Re: numberingFormat doesn't work!
          Trevorׅ Adobe Community Professional

          It's a bug.

           

          You need to use a string and not an enum.

           

          myPara[i].numberingFormat== '01,02,03...';

           

          Will work.

          The problem is the different ID language interfaces have different strings, but if it's just for you the you should ok.

           

          The strings are what you see in the UI, except for one of the Hebrew one's that has a space at the end of the string. I think the guy who did that was antisemitic. It took quite a bit of time to figure out!

           

          HTH

           

          Trevor

          • 2. Re: numberingFormat doesn't work!
            Laubender Adobe Community Professional & MVP

            Hi Trevor,

            I don't think its a bug, because DOM documentation also hints to a String as possible value for the property.

             

            You can apply a string or an enumerator for numberingFormat.

            FWIW: If you read out the value of the property its always a String.

             

            var doc = app.documents.add();
            
            // Basic Paragraph Style:
            doc.paragraphStyles[1].numberingFormat = NumberingStyle.FORMAT_NONE;
            
            // Adding two paragraph styles:
            var paraStyle1 = doc.paragraphStyles.add();
            var paraStyle2 = doc.paragraphStyles.add();
            
            
            // Style 1: Applying an enumerator:
            paraStyle1.numberingFormat = NumberingStyle.SINGLE_LEADING_ZEROS;
            
            // Style 2: Applying a string:
            paraStyle2.numberingFormat = "01,02,03...";
            
            // Reading out the values:
            $.writeln(paraStyle1.numberingFormat.constructor.name+"\t"+paraStyle1.numberingFormat);
            // String    01,02,03...
            
            $.writeln(paraStyle2.numberingFormat.constructor.name+"\t"+paraStyle2.numberingFormat);
            // String    01,02,03...
            

             

            Regards,
            Uwe

            1 person found this helpful
            • 3. Re: numberingFormat doesn't work!
              Trevorׅ Adobe Community Professional

              Hi Uwe,

               

              IMHO it's a bug.

              Their are other properties that accept strings as well as Enums, for example pageNumberStyle.

              Try

              PageNumberStyle.reflect.properties.join('\n'); // lists enums Note missing full width?

              Try

              app.activeDocument.sections[0].pageNumberStyle = "01,02,03..."; // => 01,02,03...

              app.activeDocument.sections[0].pageNumberStyle; // => SINGLE_LEADING_ZEROS

              app.activeDocument.sections[0].pageNumberStyle === PageNumberStyle.SINGLE_LEADING_ZEROS; // => true

               

              Now as it happens their are problems also with the pageNumberStyle property also but I won't go into them, the point is that when one checks a property it should return the Enum when it's available even it the property was set by a string as it does in the case of pageNumberStyle and not as a string as in the case of numberingFormat.

               

              I'll leave it to you to check out other properties that take both strings and enums.

               

              Regards

               

              Trevor