poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ye...@apache.org
Subject svn commit: r979538 - in /poi/trunk: src/documentation/content/xdocs/status.xml src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java src/ooxml/testcases/org/apache/poi/xwpf/extractor/TestXWPFWordExtractor.java test-data/document/FldSimple.docx
Date Tue, 27 Jul 2010 05:19:16 GMT
Author: yegor
Date: Tue Jul 27 05:19:15 2010
New Revision: 979538

URL: http://svn.apache.org/viewvc?rev=979538&view=rev
Log:
insert the content of fldSimple fields into the XWPFWordTextExtractor output, see bug #49455

Added:
    poi/trunk/test-data/document/FldSimple.docx   (with props)
Modified:
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/extractor/TestXWPFWordExtractor.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=979538&r1=979537&r2=979538&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Tue Jul 27 05:19:15 2010
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.7-beta2" date="2010-??-??">
+           <action dev="POI-DEVELOPERS" type="add">49455 - Insert the content of fldSimple
fields into the XWPFWordTextExtractor output</action>
            <action dev="POI-DEVELOPERS" type="add">49640 - Fixed parsing formulas containing
defined names beginning with an underscore</action>
            <action dev="POI-DEVELOPERS" type="add">49538 - Added implementation for
POISSON()</action>
            <action dev="POI-DEVELOPERS" type="add">49524 - Support for setting cell
text to be vertically rotated, via style.setRotation(0xff)</action>

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java?rev=979538&r1=979537&r2=979538&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java Tue Jul 27 05:19:15
2010
@@ -20,6 +20,7 @@ import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.Arrays;
 
 import org.apache.poi.util.Internal;
 import org.apache.xmlbeans.XmlCursor;
@@ -41,6 +42,7 @@ import org.openxmlformats.schemas.wordpr
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRunTrackChange;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSdtContentRun;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSdtRun;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSimpleField;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSpacing;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTString;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTText;
@@ -119,6 +121,9 @@ public class XWPFParagraph implements IB
       for (CTRunTrackChange c : paragraph.getInsList()) {
           rs.addAll( c.getRList() );
       }
+      for (CTSimpleField f : paragraph.getFldSimpleList()) {
+    	  rs.addAll( f.getRList() );
+      }
 
       // Get text of the paragraph
       for (int j = 0; j < rs.size(); j++) {

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/extractor/TestXWPFWordExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/extractor/TestXWPFWordExtractor.java?rev=979538&r1=979537&r2=979538&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/extractor/TestXWPFWordExtractor.java
(original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/extractor/TestXWPFWordExtractor.java
Tue Jul 27 05:19:15 2010
@@ -250,4 +250,16 @@ public class TestXWPFWordExtractor exten
         assertFalse(text.contains("AUTHOR"));
         assertFalse(text.contains("CREATEDATE"));
     }
+    
+    /**
+     * The output should contain the values of simple fields, those specified
+     * with the fldSimple element (spec sec. 17.16.19)
+     */
+    public void testFldSimpleContent() {
+        XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("FldSimple.docx");
+        XWPFWordExtractor extractor = new XWPFWordExtractor(doc);
+        String text = extractor.getText();
+        assertTrue(text.length() > 0);
+        assertTrue(text.contains("FldSimple.docx"));
+    }
 }

Added: poi/trunk/test-data/document/FldSimple.docx
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/document/FldSimple.docx?rev=979538&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/document/FldSimple.docx
------------------------------------------------------------------------------
    svn:executable = *

Propchange: poi/trunk/test-data/document/FldSimple.docx
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message