@@ -54,6 +54,57 @@ public function testConstructException()
54
54
$ oSlide ->writeSlide ();
55
55
}
56
56
57
+ /**
58
+ * @link https://github.com/PHPOffice/PHPPowerPoint/issues/35
59
+ */
60
+ public function testAlignmentShapeBottom ()
61
+ {
62
+ $ phpPowerPoint = new PhpPowerpoint ();
63
+ $ oSlide = $ phpPowerPoint ->getActiveSlide ();
64
+ $ oShape = $ oSlide ->createRichTextShape ()->setWidth (400 )->setHeight (400 )->setOffsetX (100 )->setOffsetY (100 );
65
+ $ oShape ->createTextRun ('this text should be vertically aligned ' );
66
+ $ oShape ->getActiveParagraph ()->getAlignment ()->setVertical (Alignment::VERTICAL_BOTTOM );
67
+
68
+ $ pres = TestHelperDOCX::getDocument ($ phpPowerPoint , 'PowerPoint2007 ' );
69
+ $ element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr ' ;
70
+ $ this ->assertTrue ($ pres ->elementExists ($ element , 'ppt/slides/slide1.xml ' ));
71
+ $ this ->assertEquals (Alignment::VERTICAL_BOTTOM , $ pres ->getElementAttribute ($ element , 'anchor ' , 'ppt/slides/slide1.xml ' ));
72
+ }
73
+
74
+ /**
75
+ * @link https://github.com/PHPOffice/PHPPowerPoint/issues/35
76
+ */
77
+ public function testAlignmentShapeCenter ()
78
+ {
79
+ $ phpPowerPoint = new PhpPowerpoint ();
80
+ $ oSlide = $ phpPowerPoint ->getActiveSlide ();
81
+ $ oShape = $ oSlide ->createRichTextShape ()->setWidth (400 )->setHeight (400 )->setOffsetX (100 )->setOffsetY (100 );
82
+ $ oShape ->createTextRun ('this text should be vertically aligned ' );
83
+ $ oShape ->getActiveParagraph ()->getAlignment ()->setVertical (Alignment::VERTICAL_CENTER );
84
+
85
+ $ pres = TestHelperDOCX::getDocument ($ phpPowerPoint , 'PowerPoint2007 ' );
86
+ $ element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr ' ;
87
+ $ this ->assertTrue ($ pres ->elementExists ($ element , 'ppt/slides/slide1.xml ' ));
88
+ $ this ->assertEquals (Alignment::VERTICAL_CENTER , $ pres ->getElementAttribute ($ element , 'anchor ' , 'ppt/slides/slide1.xml ' ));
89
+ }
90
+
91
+ /**
92
+ * @link https://github.com/PHPOffice/PHPPowerPoint/issues/35
93
+ */
94
+ public function testAlignmentShapeTop ()
95
+ {
96
+ $ phpPowerPoint = new PhpPowerpoint ();
97
+ $ oSlide = $ phpPowerPoint ->getActiveSlide ();
98
+ $ oShape = $ oSlide ->createRichTextShape ()->setWidth (400 )->setHeight (400 )->setOffsetX (100 )->setOffsetY (100 );
99
+ $ oShape ->createTextRun ('this text should be vertically aligned ' );
100
+ $ oShape ->getActiveParagraph ()->getAlignment ()->setVertical (Alignment::VERTICAL_TOP );
101
+
102
+ $ pres = TestHelperDOCX::getDocument ($ phpPowerPoint , 'PowerPoint2007 ' );
103
+ $ element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr ' ;
104
+ $ this ->assertTrue ($ pres ->elementExists ($ element , 'ppt/slides/slide1.xml ' ));
105
+ $ this ->assertEquals (Alignment::VERTICAL_TOP , $ pres ->getElementAttribute ($ element , 'anchor ' , 'ppt/slides/slide1.xml ' ));
106
+ }
107
+
57
108
public function testDrawingShapeBorder ()
58
109
{
59
110
$ phpPowerPoint = new PhpPowerpoint ();
0 commit comments