Footnotes & Endnotes
In Word the text of footnotes and endnotes is anchored to a particular position within the document's main text , the location of its footnote/endnote reference. The following discussion only describes footnotes, with endnotes being handled identically except that the endnote data structures contain the "edn" abbreviation where footnote data structures contain the "fnd" abbreviation. There is a structure referenced by the fib, the plcffndRef, which records the locations of the footnote references within the main text address space and another structure referenced by the fib, the plcffndTxt, which records the beginning locations of corresponding footnote text within the footnote text address space . The footnote text characters in a full saved file begin at offset fib.fcMin + fib.ccpText and extends till fib.fcMin + fib.ccpText + fib.ccpFtn. In a complex fast-saved document , the footnote text begins at CP fib.ccpText and extends till fib.ccpText + fib.ccpFtn. To find the location of the ith footnote reference in the main text address space, look up the ith entry in the plcffndRef and find the location of the text corresponding to the reference within the footnote text address space by looking up the ith entry in the plcffndTxt.
When there are n footnotes, the plcffndTxt structure consists of n+2 CP entries. The CP entries mark the beginning character position within the footnote text address space of the footnote text for the footnotes defined for the file. The beginning CP of the text of the ith footnote is the ith CP within the plcffndTxt. The limit CP of the text of the ith footnote is the i+1st CP within the plcffndTxt.
The last character of footnote text for a footnote (i.e. the character at limit CP - 1) is always a paragraph end(ASCII 13). If there are n footnotes, the n+2nd CP entry value is always 1 greater than the n+1st CP entry value. A paragraph end (ASCII 13) is always stored at the file position marked by the n+1st CP value.
When there are n footnotes, the plcffndRef structure consists of n+1 CP entries followed by n integer flags, named fAuto. The ith CP in the plcffndRef corresponds to the ith fAuto flag. The CP entries give the locations of footnote references within the main text address space. The n+1th CP entry contains the value fib.ccpText + fib.ccpFtn + fib.ccpHdr + 1. The fAuto flag contains 1 whenever the footnote reference name is auto-generated by Word.
When a footnote reference name is automatically generated by Word, Word generates the name by adding 1 to the index number of the reference in the plcffndRef and translating that number to ASCII text. When the footnote reference is auto generated, the character at the main text CP position for the footnote reference should be a footnote reference character (ASCII 5) which has a chp recorded with chp.fSpec = 1.
The number of footnotes stored in a Word binary file can be found by dividing fib.cbPlcffndTxt by 4 and subtracting 1.