Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Columns with span columns CS5

Enthusiast ,
Jun 21, 2011 Jun 21, 2011

Copy link to clipboard

Copied

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

TOPICS
Scripting

Views

544
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 21, 2011 Jun 21, 2011

Copy link to clipboard

Copied

LATEST

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.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.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines