Getting text from footnotes
K.Daube Jun 19, 2013 3:00 AMDear 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 (textObj.constructor.name !== "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

