Copy link to clipboard
Copied
I'm new to UXP and the InDesign DOM and trying to write a script that will resize overset anchored Text Frames.
A snippet of my code:
thisTextFrame.fit(myInDesign.FitOptions.FRAME_TO_CONTENT);
https://developer.adobe.com/indesign/dom/api/f/FitOptions/
This successfully increases the text frame's height, but the text now overlaps the text in the Story that follows the anchored Text Frame.
Is there a way of pushing the Story text down so that it follows the expanded TextFrame?
If I manually drag the Text Frame in InDesign to resize it, the Story text gets pushed down. I'd like to be able to automate this with a script.
Many thanks for any advice that can help me make progress.
Copy link to clipboard
Copied
If I am understanding you correctly you have an inline text frame inside the text of another text frame. I set one of these up and the fit frame to content had the same issue outside of scripting. Instead of using the fit options, maybe try setting the text frames autoSizingType inside of its textFramePreference. Set it to height only.
https://developer.adobe.com/indesign/dom/api/t/TextFramePreference/
Here are the options for the autoSizingType.
https://developer.adobe.com/indesign/dom/api/a/AutoSizingTypeEnum/
The other options would be to not have the text frame inline and set the textWrapPreferences to have the story text to a specific space away from the text frame. Then you should be able to set the fit option and the story text should fall in line.
Copy link to clipboard
Copied
Many thanks for your advice.
Using textFramePreference has the same effect on an inline object.
thisTextFrame.textFramePreferences.autoSizingType = myInDesign.AutoSizingTypeEnum.HEIGHT_ONLY;
So now I am looking at not having the text frame inline, as you suggest.
I'm thinking about scripting this using
thisTextFrame.anchoredObjectSettings.releaseAnchoredObject();
but this is having no effect.
(Referring to https://forums.creativeclouddeveloper.com/t/cant-figure-out-how-to-move-an-anchored-text-frame-out-o...