public void TestNotes() { HWPFDocument doc = HWPFTestDataSamples .OpenSampleFile("endingnote.doc"); Notes notes = doc.GetEndnotes(); Assert.AreEqual(1, notes.GetNotesCount()); Assert.AreEqual(10, notes.GetNoteAnchorPosition(0)); Assert.AreEqual(0, notes.GetNoteTextStartOffSet(0)); Assert.AreEqual(19, notes.GetNoteTextEndOffSet(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(); }