forked from PHPOffice/PHPPresentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSample_17_Comment.php
48 lines (40 loc) · 1.43 KB
/
Sample_17_Comment.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
<?php
include_once 'Sample_Header.php';
use PhpOffice\PhpPresentation\PhpPresentation;
use PhpOffice\PhpPresentation\Slide\Background\Color;
use PhpOffice\PhpPresentation\Style\Color as StyleColor;
use \PhpOffice\PhpPresentation\Slide\Background\Image;
// Create new PHPPresentation object
echo date('H:i:s') . ' Create new PHPPresentation object' . EOL;
$objPHPPresentation = new PhpPresentation();
// Create slide
echo date('H:i:s') . ' Create slide'.EOL;
$oSlide1 = $objPHPPresentation->getActiveSlide();
$oSlide1->addShape(clone $oShapeDrawing);
$oSlide1->addShape(clone $oShapeRichText);
$oAuthor = new \PhpOffice\PhpPresentation\Shape\Comment\Author();
$oAuthor->setName('Progi1984');
$oAuthor->setInitials('P');
// Add Comment 1
echo date('H:i:s') . ' Add Comment 1'.EOL;
$oComment1 = new \PhpOffice\PhpPresentation\Shape\Comment();
$oComment1->setText('Text A');
$oComment1->setOffsetX(10);
$oComment1->setOffsetY(55);
$oComment1->setDate(time());
$oComment1->setAuthor($oAuthor);
$oSlide1->addShape($oComment1);
// Add Comment
echo date('H:i:s') . ' Add Comment 2'.EOL;
$oComment2 = new \PhpOffice\PhpPresentation\Shape\Comment();
$oComment2->setText('Text B');
$oComment2->setOffsetX(170);
$oComment2->setOffsetY(180);
$oComment2->setDate(time());
$oComment2->setAuthor($oAuthor);
$oSlide1->addShape($oComment2);
// Save file
echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}