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

How to find small amounts of overflow text and expand them with a script?

Guide ,
Jul 03, 2025 Jul 03, 2025

I want to find these overflow text boxes, 

and then keep the width of the text box constant, increase the height and expand the text.

 

A small amount here means cases where the overflow is only a few lines (ex: 6 lines).

Expand only on current page.
Ignore those cases where you need to increase the page to expand them.

 

Thank you very much.

Found this written by jb_alvarado:

Can it be modified to only expand on the current page?

 

var storyTitle = "Hello I'm a title!"
var myDocument = app.documents.item(0);
var myDoc = app.activeDocument;
var myFrames = app.selection[0].parent;
var myIndexStart = app.selection[0].parentTextFrames[0].index;
while (myFrames.overflows === true) {
    var myNewPage = myDoc.pages.add();
    myNewPage.appliedMaster = myDoc.masterSpreads.item("A-Text");
    // add Page header
    myTitleFrame = myNewPage.textFrames.add();
    myTitleFrame.contents = storyTitle;
    myTitleFrame.geometricBounds = ["0mm", "0mm", "4.98mm", "148mm"];
   

 

Perhaps, there is no need for these latter.

 

 myTitleFrame.move([0, 8.62]);
    myTitleFrame.textFramePreferences.textColumnCount = 1;
    myTitleFrame.texts[0].appliedParagraphStyle = myDocument.paragraphStyleGroups.item("Meist genutzte").paragraphStyles.item("Seiten Kopf");
    var myMargin = myNewPage.marginPreferences;
    var myBounds = [myMargin.top, myMargin.left, myDoc.documentPreferences.pageHeight - myMargin.bottom, myDoc.documentPreferences.pageWidth - myMargin.right];
    var myOldRuler = myDoc.viewPreferences.rulerOrigin;
    myDoc.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;
    with (myDoc.pages[-1].textFrames.add()) {
        geometricBounds = myBounds;
        if (myDoc.pages[-2].textFrames.length >= 3) {
            previousTextFrame = myDoc.pages[-2].textFrames[myIndexStart];
        } else {
            previousTextFrame = myDoc.pages[-2].textFrames[0];
        }
        textFramePreferences.textColumnCount = 2;
        textFramePreferences.textColumnGutter = 5;
    }
    myDoc.viewPreferences.rulerOrigin = myOldRuler;
}

 

TOPICS
Scripting
94
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
Community Expert ,
Jul 04, 2025 Jul 04, 2025
LATEST

To find overflow text use the Preflight Panel.

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