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

Change number of columns in textframe

New Here ,
Feb 07, 2017 Feb 07, 2017

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
1.9K
Translate
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

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

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?

Translate
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

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

// 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.
Translate
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
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 };

(^/)

Translate
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