Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

FIT TextFrame to it's Contents by Java Script

Return to Member Forum

  • Author
    Posts
    • #80997
      Marcin Ploch
      Member

      Hello,

      I’m looking for the method or the property which will make selected TextFrame to fit to their contents vertical or horizontal as it human does clicking twice on frame anchor.

      I will be very grateful for any help :-)

      Best regards
      Marcin

    • #81010
      Peter Kahrel
      Participant

      In the object browser in the ESTK (or any of the other available object-model overviews) select textFrame. The in textFrame’s properties, look through the list — you’ll see fit at some point. Click it to follow through the properties/arguments of ‘fit’ and eventually you come up with something like this (where

      myFrame

      is a reference to a text frame):

      myFrame.fit (FitOptions.FRAME_TO_CONTENT);

      I didn’t know you can fit a frame by clicking twice on an anchor, and it doesn’t work for me. Could you elaborate?

      Peter

    • #81026
      Marcin Ploch
      Member

      Thank You Peter for the answer. This is exactly what I need :-)

      many thanks :-)

      Marcin

    • #81032
      Keith Gilbert
      Participant

      @Peter, I’m pretty sure that Marcin is referring to the bounding box “handles” of the text frame, not the frame anchor. As you probably know, double-clicking a side handle shrinks the frame to fit the text horizontally, double-clicking a bottom handle shrinks the frame to fit the text vertically, and double-clicking a corner handle does both.

      @Marcin, I’ve encountered situations where the FitOptions.FRAME_TO_CONTENT method refuses to work on a frame, even when that frame can be shrunk just fine by double-clicking on the handles. I’ve had to resort to strange work-arounds on occasion.

    • #81033
      Marcin Ploch
      Member

      @Keith,
      You are absolutely right :-), I was thinking about “handles”. It is also because of my imperfection in english. On the other hand in my country we use polish word very similar in meaning to “an anchor” to describe a frame “handle”.

      Marcin

    • #81040
      Peter Kahrel
      Participant

      Thanks, Keith. I’d forgotten that you need to click the handles, not just the frames.

      On text frames, FitOptions.FRAME_TO_CONTENT fits the frame vertically only, just like when you select that option in the interface (or press Ctrl+Alt+C or its Mac equivalent). Double-clicking the left- or right-hand handle fits the frame horizontally, but often breaks lines on its own accord, which is not what you want.

      P.

Viewing 5 reply threads
  • You must be logged in to reply to this topic.
Forum Ads