diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index adbbc7991..a27f2971d 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -33,6 +33,7 @@ + 47773 - Support for extraction of header / footer images in HWPF moved all test data to a top-level directory 47721 - Added implementation for INDIRECT() 45583 - Avoid exception when reading ClipboardData packet in OLE property sets diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java index d61d7f64d..8e8bf701c 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java @@ -189,7 +189,7 @@ public final class PicturesTable public List getAllPictures() { ArrayList pictures = new ArrayList(); - Range range = _document.getRange(); + Range range = _document.getOverallRange(); for (int i = 0; i < range.numCharacterRuns(); i++) { CharacterRun run = range.getCharacterRun(i); String text = run.text(); diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestPictures.java b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestPictures.java index fefdcf8c4..897ca86f1 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestPictures.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestPictures.java @@ -143,4 +143,12 @@ public final class TestPictures extends TestCase { List pics = doc.getPicturesTable().getAllPictures(); assertEquals(pics.size(), 2); } + + public void testPicturesInHeader() { + HWPFDocument doc = HWPFTestDataSamples.openSampleFile("header_image.doc"); + + List pics = doc.getPicturesTable().getAllPictures(); + assertEquals(pics.size(), 2); + } + } diff --git a/test-data/document/header_image.doc b/test-data/document/header_image.doc new file mode 100755 index 000000000..23444cdc1 Binary files /dev/null and b/test-data/document/header_image.doc differ