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.
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;
}
Prabu G
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?
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;
}
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
Copy link to clipboard
Copied
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 };
(^/)