]> source.dussan.org Git - poi.git/commitdiff
Support for extraction of header / footer images in HWPF, see Bugzilla 47733
authorYegor Kozlov <yegor@apache.org>
Mon, 31 Aug 2009 16:57:03 +0000 (16:57 +0000)
committerYegor Kozlov <yegor@apache.org>
Mon, 31 Aug 2009 16:57:03 +0000 (16:57 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@809659 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/status.xml
src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java
src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestPictures.java
test-data/document/header_image.doc [new file with mode: 0755]

index adbbc799158d186c40cced0a99f161f2e5663112..a27f2971d27b39879e09826419b066d55d87a29a 100644 (file)
@@ -33,6 +33,7 @@
 
     <changes>
         <release version="3.5-beta7" date="2009-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">47773 - Support for extraction of header / footer images in HWPF</action>
            <action dev="POI-DEVELOPERS" type="fix">moved all test data to a top-level directory</action>
            <action dev="POI-DEVELOPERS" type="add">47721 - Added implementation for INDIRECT()</action>
            <action dev="POI-DEVELOPERS" type="add">45583 - Avoid exception when reading ClipboardData packet in OLE property sets</action>
index d61d7f64dde4ede007643a6f5fbbe5131117196f..8e8bf701cec9b3a669e15c6b41de0fbea6bf4cf1 100644 (file)
@@ -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();
index fefdcf8c45be3fef0c4287eac4062317f4452b9e..897ca86f1c3aeaf32d863fcd35e5acd581c366cb 100644 (file)
@@ -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 (executable)
index 0000000..23444cd
Binary files /dev/null and b/test-data/document/header_image.doc differ