poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r682778 - in /poi/trunk/src/scratchpad: src/org/apache/poi/hslf/extractor/ testcases/org/apache/poi/hslf/data/ testcases/org/apache/poi/hslf/extractor/
Date Tue, 05 Aug 2008 16:33:08 GMT
Author: nick
Date: Tue Aug  5 09:33:07 2008
New Revision: 682778

URL: http://svn.apache.org/viewvc?rev=682778&view=rev
Log:
Start on bug #45537 - headers and footers from ppt

Added:
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/data/45537_Footer.ppt   (with props)
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/data/45537_Header.ppt   (with props)
Modified:
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TextExtractor.java

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java?rev=682778&r1=682777&r2=682778&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java Tue
Aug  5 09:33:07 2008
@@ -175,6 +175,12 @@
 	if(getSlideText) {
 		for(int i=0; i<_slides.length; i++) {
 			Slide slide = _slides[i];
+			
+			HeadersFooters hf = slide.getHeadersFooters();
+			if(hf != null && hf.getHeaderText() != null) {
+				ret.append(hf.getHeaderText() + "\n");
+			}
+			
 			TextRun[] runs = slide.getTextRuns();
 			for(int j=0; j<runs.length; j++) {
 				TextRun run = runs[j];
@@ -187,6 +193,10 @@
 				}
 			}
 			
+			if(hf != null && hf.getFooterText() != null) {
+				ret.append(hf.getFooterText() + "\n");
+			}
+			
 			if(getCommentText) {
 				Comment[] comments = slide.getComments();
 				for(int j=0; j<comments.length; j++) {

Added: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/data/45537_Footer.ppt
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/data/45537_Footer.ppt?rev=682778&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/data/45537_Footer.ppt
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/data/45537_Header.ppt
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/data/45537_Header.ppt?rev=682778&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/data/45537_Header.ppt
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TextExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TextExtractor.java?rev=682778&r1=682777&r2=682778&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TextExtractor.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TextExtractor.java Tue
Aug  5 09:33:07 2008
@@ -24,6 +24,7 @@
 import java.io.FileInputStream;
 
 import org.apache.poi.hslf.HSLFSlideShow;
+import org.apache.poi.hslf.usermodel.SlideShow;
 import org.apache.poi.poifs.filesystem.DirectoryNode;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 
@@ -248,4 +249,38 @@
 		text = ppe.getText();
 		assertTrue("Unable to find expected word in text\n" + text, text.contains("testdoc"));
     }
+    
+    /**
+     * From bug #45537
+     */
+    public void DISABLEDtestHeaderFooter() throws Exception {
+		String filename, text;
+		
+		// With a header
+		filename = dirname + "/45537_Header.ppt";
+		HSLFSlideShow hslf = new HSLFSlideShow(new FileInputStream(filename));
+		SlideShow ss = new SlideShow(hslf);
+		assertNotNull(ss.getSlides()[0].getHeadersFooters());
+		assertEquals("testdoc test phrase", ss.getSlides()[0].getHeadersFooters().getHeaderText());
+		
+		ppe = new PowerPointExtractor(hslf);
+
+		text = ppe.getText();
+		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"));
+
+        
+		// And with a footer
+		filename = dirname + "/45537_Footer.ppt";
+		hslf = new HSLFSlideShow(new FileInputStream(filename));
+		ss = new SlideShow(hslf);
+		assertNotNull(ss.getSlides()[0].getHeadersFooters());
+		assertEquals("testdoc test phrase", ss.getSlides()[0].getHeadersFooters().getFooterText());
+		
+		ppe = new PowerPointExtractor(filename);
+
+		text = ppe.getText();
+		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"));
+    }
 }



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


Mime
View raw message