Skip to main content
January 14, 2017
Question

get the column of a paragraph in multicolumn textframes

  • January 14, 2017
  • 1 reply
  • 335 views

Hi, I would like to know how to get the current column of a paragraph in a multicolumn textframe.

Given a story myStory formed by several multicolumn textFrames along multiple pages, I can access to its textFrames, columns of the textFrames, and paragraphs and words and lines,... in that order with codes like

var myParagraph = myStory.paragraphs[a];

var myColumn = myStory.parentTextFrames[myframe].textColumns[myColumnIndex];

 

But I dont know in which sub column is a known paragraph or line. I wonder if exists some method or property to get it as the parent, parentTextFrame or parentStory exist for other objects. In my work I want to know if a paragraph is shared between two or more sub columns.

Thanks in advance.

This topic has been closed for replies.

1 reply

Jump_Over
Legend
January 15, 2017

...

In my work I want to know if a paragraph is shared between two or more sub columns.

In this case check givenParagraph.textColumns.length

...

But I dont know in which sub column is a known paragraph or line. I wonder if exists some method or property to get it as the parent, parentTextFrame or parentStory exist for other objects.

...

In this case you may need to calculate it. For example in this way:

(to alert column's number of 1st paragraph of current selection)

var

  arrayOfIndexes = app.selection[0].parentStory.textColumns.everyItem().index,

  searchObject = app.selection[0].paragraphs[0],

  cIndex, step,

  searchIndex = searchObject.textColumns[0].index;

for (step = 0; step < arrayOfIndexes.length; step++) {

  cIndex = arrayOfIndexes[step];

  if (searchIndex == cIndex) {

       alert ("searchObject found in a textColumn number: " + (step+1) );

       break;

       }

  }

Jarek

January 20, 2017

Thanks very much, Jarek. I´m working with your code.