1 Reply Latest reply on Jun 21, 2011 7:47 PM by milligramme

    Columns with span columns CS5

    Steven.. Level 3

      In a 2 column layout in CS5, how would I know if text is in first or second column, when there are span columns text which add to the column count

        • 1. Re: Columns with span columns CS5
          milligramme Level 3

          Hi

          I tried to do with this code.

           

          if (app.selection.length === 1 && app.selection[0].hasOwnProperty('baseline')) {
               var sel = app.selection[0];
               alert(which_column(sel));
          };
          
          function which_column(sel){       
               var sel_indx = sel.texts[0].index;
               var parent_tx_column = sel.parentTextFrames[0].textColumns;
               var columns_count = sel.parentTextFrames[0].textFramePreferences.textColumnCount;
               for (var i=0, iL=parent_tx_column.length; i < iL ; i++) {
                    if (sel_indx < parent_tx_column[i].characters[-1].index){
                         var is_span_column = sel.spanColumnType === SpanColumnTypeOptions.SPAN_COLUMNS ? " (SpanColumn)" : "";
                         var result = "in Column No."+(i+1)+is_span_column;
                         return result
                    }
               };
          };
          

           

           

          This snippet returns like below

           

          1. 1st column and isSpanColumn

          2. 2nd column

          cont...

          which_column.png

           

          thankyou

          mg.