aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/java/org/apache/poi/xslf
diff options
context:
space:
mode:
authorYegor Kozlov <yegor@apache.org>2012-02-21 12:39:23 +0000
committerYegor Kozlov <yegor@apache.org>2012-02-21 12:39:23 +0000
commitbd09f7104319b1822100e3499cca0d353e5212fd (patch)
treeadd0dbfc08f6c1951d54fd0413aebfe4305f0fb5 /src/ooxml/java/org/apache/poi/xslf
parentb0b28bf53cdd2dfa0f6c3b8fcf4d687c14a76531 (diff)
downloadpoi-bd09f7104319b1822100e3499cca0d353e5212fd.tar.gz
poi-bd09f7104319b1822100e3499cca0d353e5212fd.zip
Bugzilla 52701: fixed seting vertical alignment for XSLFTableCell
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1291743 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java/org/apache/poi/xslf')
-rw-r--r--src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java
index df63212af6..a3671ab63d 100644
--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java
@@ -36,6 +36,7 @@ import org.openxmlformats.schemas.drawingml.x2006.main.STLineEndType;
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 XSLFTextShape {
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;
+ }
+
}