Copy link to clipboard
Copied
Hi,
I am working on a script which should check, if a certain text frame on a master page has the Overflowed property and adapt the height and the position accordingly.
if (lTextFrame.FirstSubCol.Overflowed == 1) ...
However, I see that the script passes the "if" only, if the text frame in the file has already the Overflowed property, when it is opened. Not, if I open the file and then change text (via a variable) in this text frame, so that the text frame then assumes this Overflowed property.
Could it be that I have to open the master page and go to the corresponding page, so that FrameMaker is able to notice this issue?
foDoc.Redisplay(); before the if had not helped.
Best regards, Winfried
Hi Winfried,
I have had similar problems with this and other properties. Apparently, FrameMaker has to display a page in order to calculate certain properties correctly. When checking overflow, I make sure to leave app.Displaying = 1 and also set these properties:
// doc is the Doc object.
doc.IsOnScreen = 1;
doc.IsInFront = 1;
// page is the Page object of the page I am checking.
doc.CurrentPage = page;
This might be better because it includes the descender height of the last line.
#target framemaker
var doc, textFrame, pgf, textLoc, prop, locY;
doc = app.ActiveDoc;
textFrame = doc.FirstSelectedGraphicInDoc;
// Get the last paragraph in the text frame.
pgf = textFrame.LastPgf;
// Make a text location at the very end of the paragraph.
textLoc = new TextLoc (pgf, Constants.FV_OBJ_END_OFFSET - 1);
// Get the baseline offset from the top of the text frame.
prop = doc.GetTextPropVal (textLoc, Con
...
Copy link to clipboard
Copied
Hi Winfried,
I have had similar problems with this and other properties. Apparently, FrameMaker has to display a page in order to calculate certain properties correctly. When checking overflow, I make sure to leave app.Displaying = 1 and also set these properties:
// doc is the Doc object.
doc.IsOnScreen = 1;
doc.IsInFront = 1;
// page is the Page object of the page I am checking.
doc.CurrentPage = page;
Copy link to clipboard
Copied
Hi Rick,
Thank you very much for this info! Then I will change the script accordingly.
Best regards, Winfried
Copy link to clipboard
Copied
I added all your commands, but this did not suffice.
I also had to show an Alert message.
Then FrameMaker was able to detect the Overflowed property.
I did not check, if the Alert message alone would have worked.
Copy link to clipboard
Copied
You might find this approach more reliable.
#target framemaker
var doc, textFrame, pgf, textLoc, prop, locY;
doc = app.ActiveDoc;
textFrame = doc.FirstSelectedGraphicInDoc;
// Get the last paragraph in the text frame.
pgf = textFrame.LastPgf;
// Make a text location at the very end of the paragraph.
textLoc = new TextLoc (pgf, Constants.FV_OBJ_END_OFFSET - 1);
// Get the baseline offset from the top of the text frame.
prop = doc.GetTextPropVal (textLoc, Constants.FP_LocY);
locY = prop.propVal.ival;
// See if the baseline offset is greater than the text frame height.
if (locY > textFrame.Height) {
alert ("Overflowed!");
}
else {
alert ("No overflow!");
}
Copy link to clipboard
Copied
This might be better because it includes the descender height of the last line.
#target framemaker
var doc, textFrame, pgf, textLoc, prop, locY;
doc = app.ActiveDoc;
textFrame = doc.FirstSelectedGraphicInDoc;
// Get the last paragraph in the text frame.
pgf = textFrame.LastPgf;
// Make a text location at the very end of the paragraph.
textLoc = new TextLoc (pgf, Constants.FV_OBJ_END_OFFSET - 1);
// Get the baseline offset from the top of the text frame.
prop = doc.GetTextPropVal (textLoc, Constants.FP_LocY);
locY = prop.propVal.ival;
// Add the descender height to the baseline.
prop = doc.GetTextPropVal (textLoc, Constants.FP_LineDescent);
locY += prop.propVal.ival;
// See if the text offset is greater than the text frame height.
if (locY > textFrame.Height) {
alert ("Fixing overflow!");
textFrame.Height = locY;
}
else {
alert ("No overflow!");
}
Copy link to clipboard
Copied
Wow, perfect! Thank you very much!