Skip to main content
June 6, 2023
Question

Test the height of the end of a column

  • June 6, 2023
  • 1 reply
  • 123 views

Hi everyone,

I'm working with FM22 on structured documents. I have a two-columns layout and I want all my pages to be fully filled. But it can happen that after some action (find/replace for instance), one of my pages is not filled anymore (a column breaks before the bottom of the textframe).

So I'd want to write a script checking this, and I need to locate the y-location of the end of each subcol and/or footnote. After numerous attempts, I need your help.

I think I know how to loop over all subcols and their footnotes, but I can't figure how to consistently reach the last character of these and how to get a y-location I can use (TextLoc object doesn't have a LocY attribute for instance).

Would you help me ?

 

Thanks in advance,

 

Martin

    This topic has been closed for replies.

    1 reply

    frameexpert
    Community Expert
    Community Expert
    June 6, 2023
    var doc, pgf, textLoc, prop, value;
    
    // Get the active document.
    doc = app.ActiveDoc;
    // Get the paragraph where the cursor is.
    pgf = doc.TextSelection.beg.obj;
    // Get the text location at the end of the paragraph.
    textLoc = new TextLoc (pgf, Constants.FV_OBJ_END_OFFSET - 1);
    // Paragraph's baseline offset from the top of the subcolumn.
    prop = doc.GetTextPropVal (textLoc, Constants.FP_LocY);
    // value is in metric units.
    value = prop.propVal.ival;
    // If you want the value in points:
    value = value / 65536;