Copy link to clipboard
Copied
Help!
Every time I think I'm on the last steps of this project I end up coming across an issue that requires me to backtrack and do several hours worth of work from scratch again.
Please tell me it's possible somehow to change all the text boxes in a document to multiline boxes? I have a 605 page document and as I was finalizing I realized that the boxes that need to be multi-line, aren't. While lots don't need to be multiline, I'd rather convert the entire project than have to redo many hours worth of work.
Copy link to clipboard
Copied
It might be possible, if the fields can be identified as belonging to one group. Do their borders overlap with each other, or do they share a similar name (such as Text1A, Text1B, Text1C, which should be merged as Text1)? If not, it will be difficult to write a script that would do it without messing up a bunch of other fields...
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Ah, that's easily done. Run this code from the JS Console:
for (var i=0; i<this.numFields; i++) {
var fname = this.getNthFieldName(i);
var f = this.getField(fname);
if (f==null) continue;
if (f.type=="text") f.multiline = true;
}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
You can run a script in the console to change all text fields to multi-line text fields. Is that what you want? Probably not. You can run a height test on the fields and only change to mult-line if they exceed a certain height. This might be a better way to go.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
There are problems with converting text fields to mult-line that do not need to be mult-line (font size set to auto could end up being too small, for example). Here's how to do it with a height test.
Find a text field in your document with a maximum height that should not be a mult-line field. Run the following script in the console (assuming the name of the field is "Text1"):
var rc=this.getField("Text1").rect; rc[1]-rc[3];
The script above will return the height in points. If it has a large number of decimal places, simply round up to a whole number. Assume it returns 18 (1/4 inch) for this example, run the following script in the console:
for(var i = 0; i< this.numFields; i++)
{
var fName = this.getNthFieldName(i);
var oFld=this.getField(fName);
if(oFld==null){continue}
if(oFld.type=="text")
{
var rc=oFld.rect;
var height=rc[1]-rc[3];
if(height>18)//Change 18 to the height you need.
{
oFld.multiline=true;
}
}
}
Copy link to clipboard
Copied
Find more inspiration, events, and resources on the new Adobe Community
Explore Now