From ad6011bf4742d767b2de8c1c3233ae9e10964f73 Mon Sep 17 00:00:00 2001 From: Maxim Valyanskiy Date: Mon, 21 Mar 2011 13:39:44 +0000 Subject: [PATCH] XWPFPicture: support for reading picture description git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1083780 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/xwpf/usermodel/XWPFPicture.java | 13 +++++++++---- .../org/apache/poi/xwpf/usermodel/TestXWPFRun.java | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFPicture.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFPicture.java index 9f0a49f24b..c25d1dd9f9 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFPicture.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFPicture.java @@ -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; + } } diff --git a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java index dd0cad864a..8ca44c9e89 100644 --- a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java +++ b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java @@ -343,6 +343,7 @@ public class TestXWPFRun extends TestCase { for (XWPFPicture pic : pictures) { assertNotNull(pic.getPictureData()); + assertEquals("DOZOR", pic.getDescription()); } count+= pictures.size(); -- 2.39.5