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.
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
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.
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...
Copy link to clipboard
Copied
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;
}
}