diff --git a/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java b/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java index 10ac95426..b4308af39 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java @@ -23,6 +23,7 @@ import java.io.FileInputStream; import java.io.UnsupportedEncodingException; import java.util.Iterator; import java.util.Arrays; +import java.util.ArrayList; import org.apache.poi.POIOLE2TextExtractor; import org.apache.poi.hwpf.HWPFDocument; @@ -252,9 +253,13 @@ public final class WordExtractor extends POIOLE2TextExtractor { ret.append(getHeaderText()); - String[] text = getParagraphText(); - for(int i=0; i text = new ArrayList(); + text.addAll(Arrays.asList(getParagraphText())); + text.addAll(Arrays.asList(getFootnoteText())); + text.addAll(Arrays.asList(getEndnoteText())); + + for(String p : text) { + ret.append(p); } ret.append(getFooterText()); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java index eb97077e8..a6fe3fdf4 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java @@ -978,6 +978,10 @@ public class Range { // TODO -instantiable superclass node = (PropertyNode)rpl.get(x); } + if (node.getEnd() <= start) { + return new int[] {rpl.size(), rpl.size()}; + } + int y = x; node = (PropertyNode)rpl.get(y); while(node.getEnd() < end && y < rpl.size()-1)