]> source.dussan.org Git - poi.git/commitdiff
XWPFPicture: support for reading picture description
authorMaxim Valyanskiy <maxcom@apache.org>
Mon, 21 Mar 2011 13:39:44 +0000 (13:39 +0000)
committerMaxim Valyanskiy <maxcom@apache.org>
Mon, 21 Mar 2011 13:39:44 +0000 (13:39 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1083780 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFPicture.java
src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java

index 9f0a49f24bd8d3ddb938fa6ddeffc9e5c234a09f..c25d1dd9f9035a43cdb98eea606211a98b43a527 100644 (file)
@@ -31,15 +31,17 @@ public class XWPFPicture {
        
        protected XWPFParagraph paragraph;
        private CTPicture ctPic;
-        
-        public XWPFParagraph getParagraph(){
+    private String description;
+
+    public XWPFParagraph getParagraph(){
                 return paragraph;
         }
         
         public XWPFPicture(CTPicture ctPic, XWPFParagraph paragraph){
                 this.paragraph = paragraph;
                 this.ctPic = ctPic;
-        }
+         description = ctPic.getNvPicPr().getCNvPr().getDescr();
+     }
         
         /**
          * Link Picture with PictureData
@@ -71,5 +73,8 @@ public class XWPFPicture {
        }
        return null;
     }
-    
+
+    public String getDescription() {
+        return description;
+    }
 }
index dd0cad864aee0ec318dfbc82369abde62ca16e91..8ca44c9e89059eb1681294613d6e9b08caf7b315 100644 (file)
@@ -343,6 +343,7 @@ public class TestXWPFRun extends TestCase {
 
                 for (XWPFPicture pic : pictures) {
                     assertNotNull(pic.getPictureData());
+                    assertEquals("DOZOR", pic.getDescription());
                 }
 
                 count+= pictures.size();