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

Re: How to find last Pgf of pasted paragraphs?

$
0
0

I see the flaw in my FirstTextFrameInFlow.LastPgf.

 

And in asking for the last text frame and last Pgf in that frame, just because you tell The FrameMaker Product to give you them, it does not mean you actually get the last Pgf:

 

var textFrame = doc.MainFlowInDoc.LastTextFrameInFlow;

var lastPgf = textFrame.LastPgf;

 

So you can depend on getting the last text frame. But you can't depend on there being a Pgf in that last text frame, because it might be an empty frame. So you have to verify it and if it's invalid (not there) step back to the previous text frame and check for the last Pgf again, and so on:

 

    while(!lastPgf.ObjectValid() && textFrame.ObjectValid())

    {

        textFrame = textFrame.PrevTextFrameInFlow;

        lastPgf = textFrame.LastPgf;

    }

 

And then, to really be able to grab that last paragraph once you've chased it down, you need to use the Russ Method on it and add a dummy paragraph. I got it now!

 

Seems like The FrameMaker Product has an ambiguous state of mind about last paragraphs.


Viewing all articles
Browse latest Browse all 3715

Trending Articles



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