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 2012/02/21 13:39:23 UTC
svn commit: r1291743 - in /poi/trunk/src:
documentation/content/xdocs/status.xml
ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java
ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java
Author: yegor
Date: Tue Feb 21 12:39:23 2012
New Revision: 1291743
URL: http://svn.apache.org/viewvc?rev=1291743&view=rev
Log:
Bugzilla 52701: fixed seting vertical alignment for XSLFTableCell
Modified:
poi/trunk/src/documentation/content/xdocs/status.xml
poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.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=1291743&r1=1291742&r2=1291743&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Tue Feb 21 12:39:23 2012
@@ -34,6 +34,7 @@
<changes>
<release version="3.8-beta6" date="2012-??-??">
+ <action dev="poi-developers" type="fix">52701 - fixed seting vertical alignment for XSLFTableCell</action>
<action dev="poi-developers" type="fix">52687 - fixed merging slides with pictures with associated custom tags</action>
<action dev="poi-developers" type="add"> allow runtime registration of functions in FormulaEvaluator</action>
<action dev="poi-developers" type="fix">52665 - When reading from a ZipFileZipEntrySource that has already been closed, give IllegalArgumentException rather than NPE</action>
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java?rev=1291743&r1=1291742&r2=1291743&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java Tue Feb 21 12:39:23 2012
@@ -36,6 +36,7 @@ import org.openxmlformats.schemas.drawin
import org.openxmlformats.schemas.drawingml.x2006.main.STLineEndWidth;
import org.openxmlformats.schemas.drawingml.x2006.main.STPenAlignment;
import org.openxmlformats.schemas.drawingml.x2006.main.STPresetLineDashVal;
+import org.openxmlformats.schemas.drawingml.x2006.main.STTextAnchoringType;
/**
* Represents a cell of a table in a .pptx presentation
@@ -299,4 +300,31 @@ public class XSLFTableCell extends XSLFT
void setVMerge(boolean merge_) {
getXmlObject().setVMerge(merge_);
}
+
+ @Override
+ public void setVerticalAlignment(VerticalAlignment anchor){
+ CTTableCellProperties cellProps = getXmlObject().getTcPr();
+ if(cellProps != null) {
+ if(anchor == null) {
+ if(cellProps.isSetAnchor()) {
+ cellProps.unsetAnchor();
+ }
+ } else {
+ cellProps.setAnchor(STTextAnchoringType.Enum.forInt(anchor.ordinal() + 1));
+ }
+ }
+ }
+
+ @Override
+ public VerticalAlignment getVerticalAlignment(){
+ CTTableCellProperties cellProps = getXmlObject().getTcPr();
+
+ VerticalAlignment align = VerticalAlignment.TOP;
+ if(cellProps != null && cellProps.isSetAnchor()) {
+ int ival = cellProps.getAnchor().intValue();
+ align = VerticalAlignment.values()[ival - 1];
+ }
+ return align;
+ }
+
}
Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java?rev=1291743&r1=1291742&r2=1291743&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java Tue Feb 21 12:39:23 2012
@@ -142,5 +142,11 @@ public class TestXSLFTable extends TestC
assertNull(cell1.getBorderRightColor());
cell1.setBorderRightColor(Color.yellow);
assertEquals(Color.yellow, cell1.getBorderRightColor());
+
+ assertEquals(VerticalAlignment.TOP, cell1.getVerticalAlignment());
+ cell1.setVerticalAlignment(VerticalAlignment.MIDDLE);
+ assertEquals(VerticalAlignment.MIDDLE, cell1.getVerticalAlignment());
+ cell1.setVerticalAlignment(null);
+ assertEquals(VerticalAlignment.TOP, cell1.getVerticalAlignment());
}
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org