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

Change number of columns in textframe

New Here ,
Feb 07, 2017 Feb 07, 2017

Copy link to clipboard

Copied

How can I change the number of columns in the current text frame?

I would like to increase and decrease the number by script.

TOPICS
Scripting

Views

1.6K

Translate

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
Engaged ,
Feb 07, 2017 Feb 07, 2017

Copy link to clipboard

Copied

Hi,

Try tis code.

var tf = app.activeDocument.textFrames;
for (i = 0; i < tf.length; i++)
{
tf.textFramePreferences.textColumnCount = 3;
}

Thanks

Prabu G

Thanks,
Prabu
Design smarter, faster, and bolder with InDesign scripting.

Votes

Translate

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
New Here ,
Feb 07, 2017 Feb 07, 2017

Copy link to clipboard

Copied

Thank you for your quick help.

The code changes all text frames.

If I only want to change the currently selected text frame, how does the code look for it?

Votes

Translate

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
Engaged ,
Feb 07, 2017 Feb 07, 2017

Copy link to clipboard

Copied

Try tis code..

// Using Selection//

// Find textFrame using inside text//

// Please select Change Current text frame//

var myDoc=app.selection[0].textFrames; 


var myText="good"; // you can use to textframe text

if(myText!=null) 
{

var tf = app.activeDocument.textFrames;

app.selection[0].textFramePreferences.textColumnCount = 3;

}

Thanks,
Prabu
Design smarter, faster, and bolder with InDesign scripting.

Votes

Translate

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
Engaged ,
Feb 07, 2017 Feb 07, 2017

Copy link to clipboard

Copied

// Please select the cuerrent textframe//

var myDoc = app.activeDocument;

var mySelection=app.activeDocument.selection[0].textFrames;

if(mySelection!=null) 

{

var tf = app.activeDocument.textFrames;

app.selection[0].textFramePreferences.textColumnCount = 3;

}

Thanks,

Prabu G

Thanks,
Prabu
Design smarter, faster, and bolder with InDesign scripting.

Votes

Translate

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
LEGEND ,
Feb 07, 2017 Feb 07, 2017

Copy link to clipboard

Copied

LATEST

Hi,

To just change Columns number, select the text frame and:

app.selection[0].textFramePreferences.textColumnCount = 4;

To change Columns number and Gutter value, select the text frame and:

with(app.selection[0].textFramePreferences) { textColumnCount = 5, textColumnGutter = 3 };

(^/)

Votes

Translate

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