Author: nick
Date: Fri May 23 08:05:12 2008
New Revision: 659564

URL: http://svn.apache.org/viewvc?rev=659564&view=rev
Log:
Patch from Yury from bug #45018 - Support for fetching embeded documents from 
within an OOXML files

Modified:
    poi/branches/ooxml/build.xml
    poi/branches/ooxml/src/documentation/content/xdocs/changes.xml
    poi/branches/ooxml/src/documentation/content/xdocs/status.xml
    poi/branches/ooxml/src/ooxml/java/org/apache/poi/POIXMLDocument.java
    poi/branches/ooxml/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
    
poi/branches/ooxml/src/ooxml/java/org/apache/poi/xwpf/extractor/XWPFWordExtractor.java

Modified: poi/branches/ooxml/build.xml
URL: 
http://svn.apache.org/viewvc/poi/branches/ooxml/build.xml?rev=659564&r1=659563&r2=659564&view=diff
==============================================================================
--- poi/branches/ooxml/build.xml (original)
+++ poi/branches/ooxml/build.xml Fri May 23 08:05:12 2008
@@ -562,6 +562,7 @@
         <uptodate property="main.test.notRequired" 
targetfile="${main.testokfile}">
             <srcfiles dir="${main.src}"/>
             <srcfiles dir="${main.src.test}"/>
+            <srcfiles dir="${ooxml.src}"/>
         </uptodate>
     </target>
 

Modified: poi/branches/ooxml/src/documentation/content/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/poi/branches/ooxml/src/documentation/content/xdocs/changes.xml?rev=659564&r1=659563&r2=659564&view=diff
==============================================================================
--- poi/branches/ooxml/src/documentation/content/xdocs/changes.xml (original)
+++ poi/branches/ooxml/src/documentation/content/xdocs/changes.xml Fri May 23 
08:05:12 2008
@@ -37,6 +37,7 @@
 
                <!-- Don't forget to update status.xml too! -->
         <release version="3.5.1-alpha1" date="2008-04-??">
+           <action dev="POI-DEVELOPERS" type="add">45018 - Support for 
fetching embeded documents from within an OOXML file</action>
            <action dev="POI-DEVELOPERS" type="add">Port support for setting a 
policy on missing / blank cells when fetching, to XSSF too</action>
            <action dev="POI-DEVELOPERS" type="add">Common text extraction 
factory, which returns the correct POITextExtractor for the supplied 
data</action>
            <action dev="POI-DEVELOPERS" type="add">Text Extraction support for 
the new OOXML files (.xlsx, .docx and .pptx)</action>

Modified: poi/branches/ooxml/src/documentation/content/xdocs/status.xml
URL: 
http://svn.apache.org/viewvc/poi/branches/ooxml/src/documentation/content/xdocs/status.xml?rev=659564&r1=659563&r2=659564&view=diff
==============================================================================
--- poi/branches/ooxml/src/documentation/content/xdocs/status.xml (original)
+++ poi/branches/ooxml/src/documentation/content/xdocs/status.xml Fri May 23 
08:05:12 2008
@@ -34,6 +34,7 @@
        <!-- Don't forget to update changes.xml too! -->
     <changes>
         <release version="3.5.1-alpha1" date="2008-04-??">
+           <action dev="POI-DEVELOPERS" type="add">45018 - Support for 
fetching embeded documents from within an OOXML file</action>
            <action dev="POI-DEVELOPERS" type="add">Port support for setting a 
policy on missing / blank cells when fetching, to XSSF too</action>
            <action dev="POI-DEVELOPERS" type="add">Common text extraction 
factory, which returns the correct POITextExtractor for the supplied 
data</action>
            <action dev="POI-DEVELOPERS" type="add">Text Extraction support for 
the new OOXML files (.xlsx, .docx and .pptx)</action>

Modified: poi/branches/ooxml/src/ooxml/java/org/apache/poi/POIXMLDocument.java
URL: 
http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/java/org/apache/poi/POIXMLDocument.java?rev=659564&r1=659563&r2=659564&view=diff
==============================================================================
--- poi/branches/ooxml/src/ooxml/java/org/apache/poi/POIXMLDocument.java 
(original)
+++ poi/branches/ooxml/src/ooxml/java/org/apache/poi/POIXMLDocument.java Fri 
May 23 08:05:12 2008
@@ -19,6 +19,8 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PushbackInputStream;
+import java.util.LinkedList;
+import java.util.List;
 
 import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.util.IOUtils;
@@ -39,6 +41,8 @@
     
     public static final String EXTENDED_PROPERTIES_REL_TYPE = 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties";;
     
+    public static final String 
OLE_OBJECT_REL_TYPE="http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";;
+    
     /** The OPC Package */
     private Package pkg;
 
@@ -50,6 +54,10 @@
      */
     private POIXMLProperties properties;
     
+       /**
+        * The embedded OLE2 files in the OPC package
+        */
+    private List<PackagePart> embedds;
     
     protected POIXMLDocument() {}
     
@@ -62,6 +70,12 @@
            
                // Get core part
                this.corePart = this.pkg.getPart(coreDocRelationship);
+               
+                       // Get any embedded OLE2 documents
+               this.embedds = new LinkedList<PackagePart>();
+               for(PackageRelationship rel : 
corePart.getRelationshipsByType(OLE_OBJECT_REL_TYPE)) {
+                   embedds.add(getTargetPart(rel));
+               }
         } catch (OpenXML4JException e) {
             throw new IOException(e.toString());
        }
@@ -190,4 +204,12 @@
                }
                return properties;
        }
+       
+    /**
+     * Get the document's embedded files.
+     */
+    public List<PackagePart> getAllEmbedds() throws OpenXML4JException
+    {
+        return embedds;
+    }
 }

Modified: 
poi/branches/ooxml/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
URL: 
http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java?rev=659564&r1=659563&r2=659564&view=diff
==============================================================================
--- poi/branches/ooxml/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java 
(original)
+++ poi/branches/ooxml/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java 
Fri May 23 08:05:12 2008
@@ -47,4 +47,11 @@
        public ExtendedProperties getExtendedProperties() throws IOException, 
OpenXML4JException, XmlException {
                return document.getProperties().getExtendedProperties();
        }
+
+       /**
+        * Returns opened document 
+        */
+       public POIXMLDocument getDocument(){
+           return document;
+       }
 }

Modified: 
poi/branches/ooxml/src/ooxml/java/org/apache/poi/xwpf/extractor/XWPFWordExtractor.java
URL: 
http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/java/org/apache/poi/xwpf/extractor/XWPFWordExtractor.java?rev=659564&r1=659563&r2=659564&view=diff
==============================================================================
--- 
poi/branches/ooxml/src/ooxml/java/org/apache/poi/xwpf/extractor/XWPFWordExtractor.java
 (original)
+++ 
poi/branches/ooxml/src/ooxml/java/org/apache/poi/xwpf/extractor/XWPFWordExtractor.java
 Fri May 23 08:05:12 2008
@@ -58,7 +58,7 @@
        public static void main(String[] args) throws Exception {
                if(args.length < 1) {
                        System.err.println("Use:");
-                       System.err.println("  HXFWordExtractor 
<filename.xlsx>");
+                       System.err.println("  HXFWordExtractor 
<filename.docx>");
                        System.exit(1);
                }
                POIXMLTextExtractor extractor = 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to