Skip to content

Commit 3afb967

Browse files
committed
#161 : Documentation
1 parent 31505b2 commit 3afb967

File tree

2 files changed

+42
-8
lines changed

2 files changed

+42
-8
lines changed

docs/slides_layout.rst

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,38 @@ Placeholders permit to link these three components together in order that the ov
1313
Master slides
1414
-------------
1515

16-
You can access to all master slides with the method ``getAllMasterSlides`` or create on with ``createMasterSlide``.
16+
You can access to all master slides with the method ``getAllMasterSlides`` or create one with ``createMasterSlide``.
1717

1818
.. code-block:: php
1919
20-
$array = $oPHPPresentation->getAllMasterSlides();
21-
$oMasterSlide = $oPHPPresentation->createMasterSlide();
20+
$arraySlideMasters = $oPHPPresentation->getAllMasterSlides();
21+
$oMasterSlide = $oPHPPresentation->createMasterSlide();
22+
23+
Slides Layout
24+
-------------
25+
26+
You can access to all slide layout from a master with the method ``getAllSlideLayouts`` or create one with ``createSlideLayout``.
27+
28+
.. code-block:: php
29+
30+
$arraySlideLayouts = $oMasterSlide->getAllSlideLayouts();
31+
$oSlideLayout = $oMasterSlide->createSlideLayout();
32+
33+
Placeholders
34+
------------
35+
36+
For each master slide or slide layout, you can add any shape like on a slide.
37+
38+
.. code-block:: php
39+
40+
$oShape = $oMasterSlide->createChartShape();
41+
$oShape = $oSlideLayout->createTableShape();
42+
43+
You can define a shape as a placeholder for each level with the method ``setPlaceHolder``.
44+
A shape defined in each level will have an override for its formatting in each level.
45+
46+
.. code-block:: php
47+
48+
use PhpOffice\PhpPresentation\Shape\Placeholder;
49+
$oShape->setPlaceHolder(new Placeholder(Placeholder::PH_TYPE_TITLE));
50+

samples/Sample_19_SlideMaster.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
$shape = $oMasterSlide->createLineShape(0, 672, 960, 672)->getBorder()->setColor(new Color(Color::COLOR_WHITE))->setLineWidth(2);
3434
$shape = $oMasterSlide->createLineShape(0, 674, 960, 674)->getBorder()->setColor(new Color(Color::COLOR_DARKBLUE))->setLineWidth(2);
3535
// Title placeholder
36-
$shape = $oMasterSlide->createRichTextShape()->setWidthAndHeight(960, 80)->setOffsetX(0)->setOffsetY(60);
36+
$shape = $oMasterSlide->createRichTextShape();
37+
$shape->setWidthAndHeight(960, 80)->setOffsetX(0)->setOffsetY(60);
3738
$shape->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_BLUE));
3839
$shape->getActiveParagraph()->getAlignment()
3940
->setHorizontal(Alignment::HORIZONTAL_RIGHT)->setMarginLeft(200)->setMarginRight(50)
@@ -46,23 +47,26 @@
4647
$textRun->getFont()->setBold(true)->setSize(30)->setColor(new Color(Color::COLOR_WHITE));
4748
$shape->setPlaceHolder(new Placeholder(Placeholder::PH_TYPE_TITLE));
4849
// Date placeholder
49-
$shape = $oMasterSlide->createRichTextShape()->setWidthAndHeight(140, 38)->setOffsetX(50)->setOffsetY(680);
50+
$shape = $oMasterSlide->createRichTextShape();
51+
$shape->setWidthAndHeight(140, 38)->setOffsetX(50)->setOffsetY(680);
5052
$shape->getActiveParagraph()->getAlignment()
5153
->setHorizontal(Alignment::HORIZONTAL_LEFT)
5254
->setVertical(Alignment::VERTICAL_BASE);
5355
$shape->setAutoFit(RichText::AUTOFIT_NORMAL);
5456
$textRun = $shape->createTextRun('01-02-2000')->getFont()->setSize(18);
5557
$shape->setPlaceHolder(new Placeholder(Placeholder::PH_TYPE_DATETIME))->getPlaceholder()->setIdx(10);
5658
// Footer placeholder
57-
$shape = $oMasterSlide->createRichTextShape()->setWidthAndHeight(468, 38)->setOffsetX(246)->setOffsetY(680);
59+
$shape = $oMasterSlide->createRichTextShape();
60+
$shape->setWidthAndHeight(468, 38)->setOffsetX(246)->setOffsetY(680);
5861
$shape->getActiveParagraph()->getAlignment()
5962
->setHorizontal(Alignment::HORIZONTAL_CENTER)
6063
->setVertical(Alignment::VERTICAL_BASE);
6164
$shape->setAutoFit(RichText::AUTOFIT_NORMAL);
6265
$textRun = $shape->createTextRun('Placeholder for Footer')->getFont()->setSize(18);
6366
$shape->setPlaceHolder(new Placeholder(Placeholder::PH_TYPE_FOOTER))->getPlaceholder()->setIdx(11);
6467
// Slidenumber placeholder
65-
$shape = $oMasterSlide->createRichTextShape()->setWidthAndHeight(140, 38)->setOffsetX(770)->setOffsetY(680);
68+
$shape = $oMasterSlide->createRichTextShape();
69+
$shape->setWidthAndHeight(140, 38)->setOffsetX(770)->setOffsetY(680);
6670
$shape->getActiveParagraph()->getAlignment()
6771
->setHorizontal(Alignment::HORIZONTAL_RIGHT)
6872
->setVertical(Alignment::VERTICAL_BASE);
@@ -86,7 +90,8 @@
8690

8791
// Create a shape (text) linked to a PlaceHolder
8892
echo date('H:i:s') . ' Create a shape (rich text)' . EOL;
89-
$shape = $currentSlide->createRichTextShape()->setWidthAndHeight(960, 80)->setOffsetX(0)->setOffsetY(60);
93+
$shape = $currentSlide->createRichTextShape();
94+
$shape->setWidthAndHeight(960, 80)->setOffsetX(0)->setOffsetY(60);
9095
$shape->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_BLUE));
9196
$shape->getActiveParagraph()->getAlignment()
9297
->setHorizontal(Alignment::HORIZONTAL_RIGHT)->setMarginLeft(200)->setMarginRight(50)

0 commit comments

Comments
 (0)