Problem with smart reflow in script
Having issues getting smart text reflow to work via script. I have a Parent Page with a primary text frame of "content."
var buildSection = function(tf, dataObj, pageRef) {
var pageToReturn = pageRef;
var parentStory = tf.parentStory;
var currIP = parentStory.insertionPoints[-1];
var key;
for (key in dataObj) {
//Do a bunch of text stuff, some of which yield overset text
}
if (tf.overflows) {
pageToReturn = doc.pages.add();
pageToReturn.appliedMaster = pageRef.appliedMaster;
pageToReturn.textFrames.itemByName("content").previousTextFrame = textFrame;
}
return pageToReturn;
}
//main call looks like:
doc.textPreferences.smartTextReflow = false;
var currPage = somePage;
for (s in sections) {
currPage = buildSection(currTf, dataObj, currPage);
}
doc.recompose();
doc.textPreferences.properties = {
smartTextReflow: true,
deleteEmptyPages: true,
limitToMasterTextFrames: false,
}
doc.recompose();
I'm working in single, not facing pages. I tried adding a second spread to the Parent Page and linking the two primary text frames, but still to no avail. Do I need to use facing pages for it to work? Is there something else I'm missing? Essentially I end up with several sets of pages, some have overflow content, some do not, all using the same parent page.
