poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r732063 - in /poi/trunk/src: documentation/content/xdocs/ ooxml/java/org/apache/poi/ ooxml/testcases/org/apache/poi/
Date Tue, 06 Jan 2009 19:09:02 GMT
Author: nick
Date: Tue Jan  6 11:09:02 2009
New Revision: 732063

URL: http://svn.apache.org/viewvc?rev=732063&view=rev
Log:
Hook up POIXMLTextExtractor.getMetadataTextExtractor() to the already written POIXMLPropertiesTextExtractor

Modified:
    poi/trunk/src/documentation/content/xdocs/changes.xml
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java
    poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/TestXMLPropertiesTextExtractor.java

Modified: poi/trunk/src/documentation/content/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/changes.xml?rev=732063&r1=732062&r2=732063&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/changes.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/changes.xml Tue Jan  6 11:09:02 2009
@@ -37,6 +37,7 @@
 
 		<!-- Don't forget to update status.xml too! -->
         <release version="3.5-beta5" date="2008-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">Hook up POIXMLTextExtractor.getMetadataTextExtractor()
to the already written POIXMLPropertiesTextExtractor</action>
            <action dev="POI-DEVELOPERS" type="fix">46472 - Avoid NPE in HPSFPropertiesExtractor
when no properties exist</action>
            <action dev="POI-DEVELOPERS" type="fix">46479 - fixed bugs related to cached
formula values and HSSFFormulaEvaluator.evaluateInCell()</action>
            <action dev="POI-DEVELOPERS" type="add">45031 - added implementation for
CHOOSE() function</action>

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=732063&r1=732062&r2=732063&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Tue Jan  6 11:09:02 2009
@@ -34,6 +34,7 @@
 	<!-- Don't forget to update changes.xml too! -->
     <changes>
         <release version="3.5-beta5" date="2008-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">Hook up POIXMLTextExtractor.getMetadataTextExtractor()
to the already written POIXMLPropertiesTextExtractor</action>
            <action dev="POI-DEVELOPERS" type="fix">46472 - Avoid NPE in HPSFPropertiesExtractor
when no properties exist</action>
            <action dev="POI-DEVELOPERS" type="fix">46479 - fixed bugs related to cached
formula values and HSSFFormulaEvaluator.evaluateInCell()</action>
            <action dev="POI-DEVELOPERS" type="add">45031 - added implementation for
CHOOSE() function</action>

Modified: poi/trunk/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java?rev=732063&r1=732062&r2=732063&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java Tue Jan  6
11:09:02 2009
@@ -136,7 +136,7 @@
 		}
 	}
 
-	public POITextExtractor getMetadataTextExtractor() {
+	public POIXMLPropertiesTextExtractor getMetadataTextExtractor() {
 		throw new IllegalStateException("You already have the Metadata Text Extractor, not recursing!");
 	}
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java?rev=732063&r1=732062&r2=732063&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java Tue Jan  6 11:09:02 2009
@@ -66,7 +66,7 @@
 	 * Returns an OOXML properties text extractor for the 
 	 *  document properties metadata, such as title and author.
 	 */
-	public POITextExtractor getMetadataTextExtractor() {
-		throw new RuntimeException("Not yet supported for OOXML!");
+	public POIXMLPropertiesTextExtractor getMetadataTextExtractor() {
+		return new POIXMLPropertiesTextExtractor(document);
 	}
 }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/TestXMLPropertiesTextExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/TestXMLPropertiesTextExtractor.java?rev=732063&r1=732062&r2=732063&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/TestXMLPropertiesTextExtractor.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/TestXMLPropertiesTextExtractor.java Tue Jan
 6 11:09:02 2009
@@ -18,9 +18,12 @@
 
 import java.io.File;
 
+import org.apache.poi.xssf.extractor.XSSFExcelExtractor;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.openxml4j.opc.Package;
 
+import sun.awt.X11.XModifierKeymap;
+
 import junit.framework.TestCase;
 
 public class TestXMLPropertiesTextExtractor extends TestCase {
@@ -30,6 +33,27 @@
 		dirname = System.getProperty("OOXML.testdata.path");
 		assertTrue( (new File(dirname)).exists() );
 	}
+	
+	public void testGetFromMainExtractor() throws Exception {
+		org.openxml4j.opc.Package pkg = Package.open(
+				(new File(dirname, "ExcelWithAttachments.xlsx")).toString()
+		);
+		XSSFWorkbook wb = new XSSFWorkbook(pkg);
+
+		XSSFExcelExtractor ext = new XSSFExcelExtractor(wb);
+		POIXMLPropertiesTextExtractor textExt = ext.getMetadataTextExtractor();
+		
+		// Check basics
+		assertNotNull(textExt);
+		assertTrue(textExt.getText().length() > 0);
+		
+		// Check some of the content
+		String text = textExt.getText();
+		String cText = textExt.getCorePropertiesText();
+		
+		assertTrue(text.contains("LastModifiedBy = Yury Batrakov"));
+		assertTrue(cText.contains("LastModifiedBy = Yury Batrakov"));
+	}
 
 	public void testCore() throws Exception {
 		org.openxml4j.opc.Package pkg = Package.open(



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


Mime
View raw message