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

How to mark overflow

New Here ,
Oct 21, 2018 Oct 21, 2018

Copy link to clipboard

Copied

Hey,

I'd like to have a script that goes through the document and places a string in each paragraph or table that has overflow. Any ideas how I can achieve this?

Thanks.

TOPICS
Scripting

Views

274

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

correct answers 1 Correct answer

Community Expert , Oct 21, 2018 Oct 21, 2018

Here is a general-purpose function for getting parent Page for an object. Once you get the Page object, you can test its Page.PageNum property.

function getPage (obj,doc) {

   

    var frame = 0, cell = 0;

    var objType = "", prop = 0;

   

    while (obj) {

       

        frame = obj;

        objType = obj.constructor.name;

       

        switch (objType) {

            case "SubCol" :

                obj = obj.ParentTextFrame;

                break;

            case "Tbl" :

                obj = obj.Fir

...

Votes

Translate

Translate
Community Expert ,
Oct 21, 2018 Oct 21, 2018

Copy link to clipboard

Copied

Tables (Tbl) and Columns (SubCol) objects have an Overflowed property that will tell you if they are overflowed. I am not sure how to identify which paragraphs are actually overflowed, but it may involve seeing if their Y location is greater than the subcolumn (or text frame) height.

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 ,
Oct 21, 2018 Oct 21, 2018

Copy link to clipboard

Copied

Thanks for the reply!

I've played around with this for a few hours now, I now feel like I asked the wrong question to begin with.

Instead of overflow, I think I need to determine whether pagination occurs. Say I have a table with 5 rows, 2 on one page and 3 on another; I'd like to place a marker after the 2nd row. I will then use that marker when publishing to HTML.

I was thinking of looping through all rows in all tables, and then comparing the pages of the rows of the same table to figure this out, but I can't seem to get page information from a row (or cell)

Afterwards, I will have to figure out a way to do this for paragraphs, but one step at a time...

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
Community Expert ,
Oct 21, 2018 Oct 21, 2018

Copy link to clipboard

Copied

LATEST

Here is a general-purpose function for getting parent Page for an object. Once you get the Page object, you can test its Page.PageNum property.

function getPage (obj,doc) {

   

    var frame = 0, cell = 0;

    var objType = "", prop = 0;

   

    while (obj) {

       

        frame = obj;

        objType = obj.constructor.name;

       

        switch (objType) {

            case "SubCol" :

                obj = obj.ParentTextFrame;

                break;

            case "Tbl" :

                obj = obj.FirstRowInTbl.FirstCellInRow;

                break;

            case "Row" :

                obj = obj.FirstCellInRow;

                break;

            case "Cell" :

            case "Pgf" :

            case "AFrame" :

                obj = obj.InTextFrame;

                break;

            case "TextLine" :

            case "TextFrame" :

            case "UnanchoredFrame" :

            case "Arc" :

            case "Ellipse" :

            case "Group" :

            case "Inset" :

            case "Line" :

            case "Math" :

            case "Polygon" :

            case "Polyline" :

            case "Rectangle" :

            case "RoundRect" :

                if (obj.FrameParent.ObjectValid()) {

                    obj = obj.FrameParent;

                } else {

                    obj = 0;

                }

                break;

            case "XRef" :

                prop = doc.GetTextPropVal (obj.TextRange.beg, Constants.FP_InTextObj);

                var obj = prop.propVal.obj;

                break;           

            default:

                // Prevent endless loop if unknown object type is found.

                obj = 0;

                break;

        }

    }

    if (frame) {

        return frame.PageFramePage;

    } else {

        return 0;

    }

}

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