I'm pasting several Pgf objects at once into a file (a changes file of sections containing changebars), in the main text flow. I want a divider line to go at the end of each pasted section, so I try to insert one after the paste operation. But instead of a line between each section, all lines are added at the end of the file, after all the sections. So if there are 3 pasted sections, at the end of the file are three lines. My code is below, do you know how I might remedy this?
Thanks, Mark
function copyPasteChanges(doc, chgRange) {
// Select section with changebar and copy it.
doc.TextSelection = chgRange;
doc.Copy();
// Get the changes doc ready and paste the changed section into it.
var firstChgPgf = changesDoc.MainFlowInDoc.FirstTextFrameInFlow.LastPgf;
var changesTloc = new TextLoc(firstChgPgf, Constants.FV_OBJ_END_OFFSET);
var changesTRange = new TextRange(changesTloc, changesTloc);
changesDoc.TextSelection = changesTRange;
changesDoc.Paste();
// Get to end of file again (I think)
var lastPgf = changesDoc.MainFlowInDoc.FirstTextFrameInFlow.LastPgf;
var dividerPgf = changesDoc.NewSeriesPgf ( lastPgf );
var TLoc = new TextLoc ( dividerPgf, 0 );
changesDoc.AddText ( TLoc, "_______________________" );
}