From: Yegor Kozlov Date: Mon, 31 Aug 2009 16:57:03 +0000 (+0000) Subject: Support for extraction of header / footer images in HWPF, see Bugzilla 47733 X-Git-Tag: REL_3_5-FINAL~21 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=96d4031d66b7934b556d8fc812d3758dc8e1ec04;p=poi.git Support for extraction of header / footer images in HWPF, see Bugzilla 47733 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@809659 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index adbbc79915..a27f2971d2 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 d61d7f64dd..8e8bf701ce 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 fefdcf8c45..897ca86f1c 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 0000000000..23444cdc1a Binary files /dev/null and b/test-data/document/header_image.doc differ