You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ye...@apache.org on 2009/04/20 20:04:37 UTC

svn commit: r766775 - in /poi/trunk/src: documentation/content/xdocs/changes.xml documentation/content/xdocs/status.xml ooxml/java/org/apache/poi/xslf/extractor/XSLFPowerPointExtractor.java ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java

Author: yegor
Date: Mon Apr 20 18:04:37 2009
New Revision: 766775

URL: http://svn.apache.org/viewvc?rev=766775&view=rev
Log:
Fixed XSLFPowerPointExtractor to properly process line breaks, see bugzilla 46568

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/xslf/extractor/XSLFPowerPointExtractor.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.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=766775&r1=766774&r2=766775&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/changes.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/changes.xml Mon Apr 20 18:04:37 2009
@@ -37,6 +37,7 @@
 
 		<!-- Don't forget to update status.xml too! -->
         <release version="3.5-beta6" date="2009-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">46568 - Fixed XSLFPowerPointExtractor to properly process line breaks</action>
            <action dev="POI-DEVELOPERS" type="fix">39056 - Fixed POIFSFileSystem to set CLSID of root when constructing instances from InputStream</action>
            <action dev="POI-DEVELOPERS" type="fix">47054 - Fixed cloneStyleFrom to avoid exception when cloning styles of the same family</action>
            <action dev="POI-DEVELOPERS" type="fix">46186 - Fixed Sheet to read GutsRecord in the Sheet(RecordStream rs)</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=766775&r1=766774&r2=766775&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Mon Apr 20 18:04:37 2009
@@ -34,6 +34,7 @@
 	<!-- Don't forget to update changes.xml too! -->
     <changes>
         <release version="3.5-beta6" date="2009-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">46568 - Fixed XSLFPowerPointExtractor to properly process line breaks</action>
            <action dev="POI-DEVELOPERS" type="fix">39056 - Fixed POIFSFileSystem to set CLSID of root when constructing instances from InputStream</action>
            <action dev="POI-DEVELOPERS" type="fix">47054 - Fixed cloneStyleFrom to avoid exception when cloning styles of the same family</action>
            <action dev="POI-DEVELOPERS" type="fix">46186 - Fixed Sheet to read GutsRecord in the Sheet(RecordStream rs)</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=766775&r1=766774&r2=766775&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 Mon Apr 20 18:04:37 2009
@@ -25,9 +25,12 @@
 import org.apache.poi.xslf.usermodel.XMLSlideShow;
 import org.apache.poi.xslf.usermodel.XSLFSlide;
 import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlCursor;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTRegularTextRun;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextLineBreak;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTComment;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTCommentList;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape;
@@ -140,11 +143,18 @@
 				CTTextParagraph[] paras = 
 					textBody.getPArray();
 				for (int j = 0; j < paras.length; j++) {
-					CTRegularTextRun[] textRuns =
-						paras[j].getRArray();
-					for (int k = 0; k < textRuns.length; k++) {
-						text.append( textRuns[k].getT() );
-					}
+                    XmlCursor c = paras[j].newCursor();
+                    c.selectPath("./*");
+                    while (c.toNextSelection()) {
+                        XmlObject o = c.getObject();
+                        if(o instanceof CTRegularTextRun){
+                            CTRegularTextRun txrun = (CTRegularTextRun)o;
+                            text.append( txrun.getT() );
+                        } else if (o instanceof CTTextLineBreak){
+                            text.append('\n');
+                        }
+                    }
+                    
 					// End each paragraph with a new line
 					text.append("\n");
 				}

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java?rev=766775&r1=766774&r2=766775&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java Mon Apr 20 18:04:37 2009
@@ -111,7 +111,9 @@
      */
     public void cloneStyleFrom(CellStyle source) {
         if(source instanceof XSSFCellStyle) {
-            this.cloneStyleFrom(source);
+            XSSFCellStyle src = (XSSFCellStyle)source;
+            cellXf.set(src.getCoreXf());
+            cellStyleXf.set(src.getStyleXf());
         } else {
             throw new IllegalArgumentException("Can only clone from one XSSFCellStyle to another, not between HSSFCellStyle and XSSFCellStyle");
         }



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