Quantcast
Channel: Adobe Community: Message List - FrameMaker Scripting
Viewing all articles
Browse latest Browse all 3715

Re: Best way to copy range of paragraphs

$
0
0

Here's my first rudimentary working code that selects the changebar Pgf (just one at this point), copies it, and pastes it into a second changes document. Thanks for your help Jang.

 

// findChangebar() returns Pgf object that has a changebar.

changePgf = findChangebar(doc);

if (changePgf) {

    var tBegin = new TextLoc();

    var tEnd = new TextLoc();

    var chgRange = new TextRange();

    tBegin.obj = changePgf;

    tBegin.offset = 0;

    tEnd.obj = changePgf;

    // This constant gets you the end of the paragraph.

    tEnd.offset = Constants.FV_OBJ_END_OFFSET;

    chgRange.beg = tBegin;

    chgRange.end = tEnd;

    doc.TextSelection = chgRange;

    doc.Copy();

    // Text selection now held in clipboard, available to other docs.

 

     // changesDoc is already open.

    var firstChgPgf = changesDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;

    var changesTbeg = new TextLoc();

    var changesTend = new TextLoc;

    var chgRange = new TextRange();

    changesTbeg.obj = firstChgPgf;

    changesTbeg.offset = 0;

    changesTend.obj = firstChgPgf;

     // I found it was not necessary to select to the end of the paragraph, so offset 0.

    changesTend.offset = 0;

    chgRange.beg = changesTbeg;

    chgRange.end = changesTend;

    changesDoc.TextSelection = chgRange;

    changesDoc.Paste();

}


Viewing all articles
Browse latest Browse all 3715

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>