You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2011/09/04 23:16:33 UTC
svn commit: r1165112 - in /poi/trunk/src:
documentation/content/xdocs/status.xml
ooxml/java/org/apache/poi/xslf/extractor/XSLFPowerPointExtractor.java
ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java
Author: nick
Date: Sun Sep 4 21:16:32 2011
New Revision: 1165112
URL: http://svn.apache.org/viewvc?rev=1165112&view=rev
Log:
Update XSLFPowerPointExtractor to include Comment Authors along with comment text
Modified:
poi/trunk/src/documentation/content/xdocs/status.xml
poi/trunk/src/ooxml/java/org/apache/poi/xslf/extractor/XSLFPowerPointExtractor.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java
Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=1165112&r1=1165111&r2=1165112&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Sun Sep 4 21:16:32 2011
@@ -34,6 +34,9 @@
<changes>
<release version="3.8-beta5" date="2011-??-??">
+ <action dev="poi-developers" type="add">XSLFPowerPointExtractor support for including comment authors with comment text</action>
+ <action dev="poi-developers" type="fix">Converted XSLFPowerPointExtractor to use UserModel for all text extraction</action>
+ <action dev="poi-developers" type="add">XSLF initial UserModel support for Notes and Comments for Slides</action>
</release>
<release version="3.8-beta4" date="2011-08-26">
<action dev="poi-developers" type="fix">51678 - Extracting text from Bug51524.zip is slow</action>
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/extractor/XSLFPowerPointExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/extractor/XSLFPowerPointExtractor.java?rev=1165112&r1=1165111&r2=1165112&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/extractor/XSLFPowerPointExtractor.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/extractor/XSLFPowerPointExtractor.java Sun Sep 4 21:16:32 2011
@@ -24,6 +24,7 @@ import org.apache.poi.openxml4j.opc.OPCP
import org.apache.poi.xslf.XSLFSlideShow;
import org.apache.poi.xslf.usermodel.DrawingParagraph;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
+import org.apache.poi.xslf.usermodel.XSLFCommentAuthors;
import org.apache.poi.xslf.usermodel.XSLFComments;
import org.apache.poi.xslf.usermodel.XSLFCommonSlideData;
import org.apache.poi.xslf.usermodel.XSLFNotes;
@@ -31,6 +32,7 @@ import org.apache.poi.xslf.usermodel.XSL
import org.apache.poi.xslf.usermodel.XSLFSlide;
import org.apache.xmlbeans.XmlException;
import org.openxmlformats.schemas.presentationml.x2006.main.CTComment;
+import org.openxmlformats.schemas.presentationml.x2006.main.CTCommentAuthor;
public class XSLFPowerPointExtractor extends POIXMLTextExtractor {
public static final XSLFRelation[] SUPPORTED_TYPES = new XSLFRelation[] {
@@ -97,6 +99,7 @@ public class XSLFPowerPointExtractor ext
StringBuffer text = new StringBuffer();
XSLFSlide[] slides = slideshow.getSlides();
+ XSLFCommentAuthors commentAuthors = slideshow.getCommentAuthors();
for (XSLFSlide slide : slides) {
try {
@@ -112,11 +115,17 @@ public class XSLFPowerPointExtractor ext
// If the slide has comments, do those too
if (comments != null) {
for (CTComment comment : comments.getCTCommentsList().getCmList()) {
- // TODO - comment authors too
- // (They're in another stream)
- text.append(
- comment.getText() + "\n"
- );
+ // Do the author if we can
+ if (commentAuthors != null) {
+ CTCommentAuthor author = commentAuthors.getAuthorById(comment.getAuthorId());
+ if(author != null) {
+ text.append(author.getName() + ": ");
+ }
+ }
+
+ // Then the comment text, with a new line afterwards
+ text.append(comment.getText());
+ text.append("\n");
}
}
}
Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java?rev=1165112&r1=1165111&r2=1165112&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java Sun Sep 4 21:16:32 2011
@@ -112,6 +112,10 @@ public class TestXSLFPowerPointExtractor
// Check comments are there
assertTrue("Unable to find expected word in text\n" + text, text.contains("testdoc"));
+ assertTrue("Unable to find expected word in text\n" + text, text.contains("test phrase"));
+
+ // Check the authors came through too
+ assertTrue("Unable to find expected word in text\n" + text, text.contains("XPVMWARE01"));
}
public void testTable() throws Exception {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org