With that out of the way, here is the part that you can use instead of your own commented-out code. It assumes the to be added text is in an overset text frame on the very last page (index -1) of your current document. It also assumes this text frame is the only one on that page(!).
startframe = app.activeDocument.pages[-1].textFrames[0];
while (startframe.overflows)
{
newpg = app.activeDocument.pages.add(LocationOptions.AT_END);
newframe = newpg.textFrames.add();
if (newpg.index & 1)
newframe.geometricBounds = [newpg.bounds[0]+newpg.marginPreferences.top,
newpg.bounds[1]+newpg.marginPreferences.left,
newpg.bounds[2]-newpg.marginPreferences.bottom,
newpg.bounds[3]-newpg.marginPreferences.right];
else
newframe.geometricBounds = [newpg.bounds[0]+newpg.marginPreferences.top,
newpg.bounds[1]+newpg.marginPreferences.right,
newpg.bounds[2]-newpg.marginPreferences.bottom,
newpg.bounds[3]-newpg.marginPreferences.left];
startframe.nextTextFrame = newframe;
startframe = newframe;
// Check for Continuous Overflow!
if (startframe.contents.length == 0)
{
alert ("Continuous Overflow detected, cannot continue");
break;
}
}
That is an annoying issue you got, with ID slowing down after a Data Merge. I can't recall if that has been reported before; you might want to ask on the Adobe InDesign forum. Only maybe: perhaps you can manually try this. Directly after doing your merge, don't use "Save" but do a "Save As", and overwrite your old file. "Save As" cleans up and reallocates memory; I've found it sometimes helps. If that doesn't work, I cannot recommend anything else than, indeed, export to IDML and re-open that.
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-51718-2.html
太棒了