コード例 #1
0
        protected void ProcessNoteAnchor(HWPFDocument doc, CharacterRun characterRun, XmlElement block)
        {
            {
                Notes footnotes = doc.GetFootnotes();
                int   noteIndex = footnotes.GetNoteIndexByAnchorPosition(characterRun.StartOffset);
                if (noteIndex != -1)
                {
                    Range footnoteRange       = doc.GetFootnoteRange();
                    int   rangeStartOffset    = footnoteRange.StartOffset;
                    int   noteTextStartOffset = footnotes.GetNoteTextStartOffSet(noteIndex);
                    int   noteTextEndOffset   = footnotes.GetNoteTextEndOffSet(noteIndex);

                    Range noteTextRange = new Range(rangeStartOffset + noteTextStartOffset, rangeStartOffset + noteTextEndOffset, doc);

                    ProcessFootnoteAutonumbered(doc, noteIndex, block, noteTextRange);
                    return;
                }
            }
            {
                Notes endnotes  = doc.GetEndnotes();
                int   noteIndex = endnotes.GetNoteIndexByAnchorPosition(characterRun.StartOffset);
                if (noteIndex != -1)
                {
                    Range endnoteRange        = doc.GetEndnoteRange();
                    int   rangeStartOffset    = endnoteRange.StartOffset;
                    int   noteTextStartOffset = endnotes.GetNoteTextStartOffSet(noteIndex);
                    int   noteTextEndOffset   = endnotes.GetNoteTextEndOffSet(noteIndex);

                    Range noteTextRange = new Range(rangeStartOffset + noteTextStartOffset, rangeStartOffset + noteTextEndOffset, doc);

                    ProcessEndnoteAutonumbered(doc, noteIndex, block, noteTextRange);
                    return;
                }
            }
            throw new NotImplementedException();
        }