-
Notifications
You must be signed in to change notification settings - Fork 524
/
Copy pathSample_21_AutoShape.php
65 lines (58 loc) · 2.03 KB
/
Sample_21_AutoShape.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
include_once 'Sample_Header.php';
use PhpOffice\PhpPresentation\PhpPresentation;
use PhpOffice\PhpPresentation\Shape\AutoShape;
use PhpOffice\PhpPresentation\Style\Color;
use PhpOffice\PhpPresentation\Style\Fill;
// Create new PHPPresentation object
echo date('H:i:s') . ' Create new PHPPresentation object' . EOL;
$objPHPPresentation = new PhpPresentation();
// Set properties
echo date('H:i:s') . ' Set properties' . EOL;
$objPHPPresentation->getDocumentProperties()->setCreator('PHPOffice')
->setLastModifiedBy('PHPPresentation Team')
->setTitle('Sample 21 AutoShape')
->setSubject('Sample 21 Subject')
->setDescription('Sample 21 Description')
->setKeywords('office 2007 openxml libreoffice odt php')
->setCategory('Sample Category');
// Create slide
echo date('H:i:s') . ' Create slide' . EOL;
$currentSlide = $objPHPPresentation->getActiveSlide();
$autoShape = new AutoShape();
$autoShape->setType(AutoShape::TYPE_PENTAGON)
->setText('Step 1')
->setOffsetX(93)
->setOffsetY(30)
->setWidthAndHeight(175, 100);
$autoShape->getOutline()
->setWidth(0)
->getFill()
->setFillType(Fill::FILL_SOLID)
->setStartColor(new Color(Color::COLOR_BLACK));
$autoShape->getFill()
->setFillType(Fill::FILL_SOLID)
->setStartColor(new Color('804F81BD'));
$currentSlide->addShape($autoShape);
for ($inc = 1; $inc < 5; ++$inc) {
$autoShape = new AutoShape();
$autoShape->setType(AutoShape::TYPE_CHEVRON)
->setText('Step ' . ($inc + 1))
->setOffsetX(93 + $inc * 100)
->setOffsetY(30)
->setWidthAndHeight(175, 100);
$autoShape->getOutline()
->setWidth($inc)
->getFill()
->setFillType(Fill::FILL_SOLID)
->setStartColor(new Color(Color::COLOR_BLACK));
$autoShape->getFill()
->setFillType(Fill::FILL_SOLID)
->setStartColor(new Color('FF4F81BD'));
$currentSlide->addShape($autoShape);
}
// Save file
echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}