Skip navigation
Currently Being Moderated

Getting text from footnotes

Jun 19, 2013 3:00 AM

Dear all,


Having managed to extract citations from ordinary paragraphs and table cells I now want to get it also from footnotes. See the complete script and test-doc (FN-11) doc here.


I get the first footnote paragraph with its citation correctly.

But my construct to get the next paragraph of the footnote obviously is wrong - there is no NextPgfInFn (or NextPgf) mentioned in the Scripting Guide, only FirstPgf and LastPgf. But it is possible to have multiple paragraphs in footnotes (see test-doc). And hence the function GetText fails for the 'second paragraph' in the footnote.


function processFootnote (fn, doc) {
// find citations in footnotes
    var fnText = "";
    var fnPara = fn.FirstPgf;
    while (fn.ObjectValid()) {
      fnText = (GetText(fnPara));
        alert (fnText);                    // the text of the cell
        var citations = GetTempCitations (fnText);
        var nCitations = citations.length;
        alert (nCitations + " Citations = " + citations); 
    fnPara = fnPara.NextPgfInFn;                                               // <-------------- this is not valid
} //--------------------------------------------------------------------------
function GetText (textObj, doc) {
  // Gets the text from the text object.
  var text = "";
  // Get a list of the strings in the text object or text range.
  if ( !== "TextRange") {                        // <--------------- Undefined is not an object
    var textItems = textObj.GetText(Constants.FTI_String);
  } else {
    var textItems = doc.GetTextForRange(textObj, Constants.FTI_String);
  // Concatenate the strings.
  for (var i = 0; i < textItems.len; i += 1) {
    text += (textItems[i].sdata);
  return text; // Return the text
} //--------------------------------------------------------------------------


What would be a valid construct to get into all paragraphs of the footnote?


And there the next question lures: does function processFootnote also handle table footnotes ?


Thanks for Your help.

Klaus Daube

  • Currently Being Moderated
    Jun 19, 2013 3:40 AM   in reply to K.Daube

    Hi Klaus,


    Use NextPgfInFlow



    Mark as:
  • Currently Being Moderated
    Jun 20, 2013 4:37 AM   in reply to K.Daube

    Hi Klaus, The code in your function is not quite right. The way I understand it, you are using the processFootnote function to process a single footnote. If that is the case, then this line:


    while (fn.ObjectValid()) {


    is not correct. The fn object will always be valid and that is why you have a runaway loop. You need this instead:


    while (fnPara.ObjectValid()) {


    This code will be unnecessary:


    if (fnText == ""){ return; }



    Mark as:

More Like This

  • Retrieving data ...

Incoming Links

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points