You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2010/06/29 16:04:12 UTC

svn commit: r958972 - in /poi/trunk/src: documentation/content/xdocs/ ooxml/java/org/apache/poi/xwpf/usermodel/

Author: nick
Date: Tue Jun 29 14:04:11 2010
New Revision: 958972

URL: http://svn.apache.org/viewvc?rev=958972&view=rev
Log:
Fix bug #49508 - Allow the addition of paragraphs to XWPF Table Cells. (Also fixed a few related warnings too)

Modified:
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/IBody.java
    poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFFooter.java
    poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeader.java
    poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.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=958972&r1=958971&r2=958972&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Tue Jun 29 14:04:11 2010
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.7-beta2" date="2010-??-??">
+           <action dev="POI-DEVELOPERS" type="add">49508 - Allow the addition of paragraphs to XWPF Table Cells</action>
            <action dev="POI-DEVELOPERS" type="fix">49446 - Don't consider 17.16.23 field codes as properly part of the paragraph's text</action>
            <action dev="POI-DEVELOPERS" type="fix">XSLFSlideShow shouldn't break on .thmx (theme) files. Support for them is still very limited though</action>
         </release>

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/IBody.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/IBody.java?rev=958972&r1=958971&r2=958972&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/IBody.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/IBody.java Tue Jun 29 14:04:11 2010
@@ -19,14 +19,11 @@ package org.apache.poi.xwpf.usermodel;
 
 import java.util.List;
 
-import org.apache.poi.POIXMLDocumentPart;
 import org.apache.xmlbeans.XmlCursor;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc;
 
-
-
 /**
  * <p>
  * 8 Jan 2010
@@ -123,9 +120,6 @@ public interface IBody {
 	 * @return
 	 */
 	XWPFTableCell getTableCell(CTTc cell);
-  	
-
-	
 	
 }
 

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFFooter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFFooter.java?rev=958972&r1=958971&r2=958972&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFFooter.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFFooter.java Tue Jun 29 14:04:11 2010
@@ -80,7 +80,7 @@ public class XWPFFooter extends XWPFHead
     protected void commit() throws IOException {
         XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
         xmlOptions.setSaveSyntheticDocumentElement(new QName(CTNumbering.type.getName().getNamespaceURI(), "ftr"));
-        Map map = new HashMap();
+        Map<String,String> map = new HashMap<String, String>();
         map.put("http://schemas.openxmlformats.org/markup-compatibility/2006", "ve");
         map.put("urn:schemas-microsoft-com:office:office", "o");
         map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r");

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeader.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeader.java?rev=958972&r1=958971&r2=958972&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeader.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeader.java Tue Jun 29 14:04:11 2010
@@ -84,7 +84,7 @@ public class XWPFHeader extends XWPFHead
     protected void commit() throws IOException {
         XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
         xmlOptions.setSaveSyntheticDocumentElement(new QName(CTNumbering.type.getName().getNamespaceURI(), "hdr"));
-        Map map = new HashMap();
+        Map<String,String> map = new HashMap<String, String>();
         map.put("http://schemas.openxmlformats.org/markup-compatibility/2006", "ve");
         map.put("urn:schemas-microsoft-com:office:office", "o");
         map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r");

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java?rev=958972&r1=958971&r2=958972&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java Tue Jun 29 14:04:11 2010
@@ -45,7 +45,7 @@ public class XWPFTableCell implements IB
         this.part = part;
         this.tableRow = tableRow;
         // NB: If a table cell does not include at least one block-level element, then this document shall be considered corrupt.
-        if(cell.getPArray().length<1)
+        if(cell.getPList().size()<1)
         	cell.addNewP();
         bodyElements = new ArrayList<IBodyElement>();
         paragraphs = new ArrayList<XWPFParagraph>();
@@ -90,6 +90,16 @@ public class XWPFTableCell implements IB
     }
     
     /**
+     * Add a Paragraph to this Table Cell
+     * @return The paragraph which was added
+     */
+    public XWPFParagraph addParagraph() {
+       XWPFParagraph p = new XWPFParagraph(ctTc.addNewP(), this);
+       addParagraph(p);
+       return p;
+    }
+    
+    /**
      * add a Paragraph to this TableCell
      * @param p the paragaph which has to be added
      */
@@ -296,7 +306,7 @@ public class XWPFTableCell implements IB
 	public void insertTable(int pos, XWPFTable table) {
 		bodyElements.add(pos, table);
 		int i;
-    	for (i = 0; i < ctTc.getTblArray().length; i++) {
+    	for (i = 0; i < ctTc.getTblList().size(); i++) {
 			CTTbl tbl = ctTc.getTblArray(i);
 			if(tbl == table.getCTTbl()){
 				break;



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