|
7 | 7 |
|
8 | 8 | include_once 'Sample_Header.php';
|
9 | 9 |
|
10 |
| -function fnSlideRichText(PhpPresentation $objPHPPresentation) { |
11 |
| - // Create templated slide |
12 |
| - echo date('H:i:s') . ' Create templated slide'.EOL; |
13 |
| - $currentSlide = createTemplatedSlide($objPHPPresentation); |
14 |
| - |
15 |
| - // Create a shape (text) |
16 |
| - echo date('H:i:s') . ' Create a shape (rich text)'.EOL; |
17 |
| - $shape = $currentSlide->createRichTextShape(); |
18 |
| - $shape->setHeight(100); |
19 |
| - $shape->setWidth(600); |
20 |
| - $shape->setOffsetX(100); |
21 |
| - $shape->setOffsetY(100); |
22 |
| - $shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_LEFT ); |
23 |
| - |
24 |
| - $textRun = $shape->createTextRun('RichText with'); |
25 |
| - $textRun->getFont()->setBold(true); |
26 |
| - $textRun->getFont()->setSize(28); |
27 |
| - $textRun->getFont()->setColor(new Color( 'FF000000' )); |
28 |
| - |
29 |
| - $shape->createBreak(); |
30 |
| - |
31 |
| - $textRun = $shape->createTextRun('Multiline'); |
32 |
| - $textRun->getFont()->setBold(true); |
33 |
| - $textRun->getFont()->setSize(60); |
34 |
| - $textRun->getFont()->setColor(new Color( 'FF000000' )); |
| 10 | +function fnSlideRichText(PhpPresentation $objPHPPresentation) |
| 11 | +{ |
| 12 | + // Create templated slide |
| 13 | + echo date('H:i:s') . ' Create templated slide' . EOL; |
| 14 | + $currentSlide = createTemplatedSlide($objPHPPresentation); |
| 15 | + |
| 16 | + // Create a shape (text) |
| 17 | + echo date('H:i:s') . ' Create a shape (rich text)' . EOL; |
| 18 | + $shape = $currentSlide->createRichTextShape(); |
| 19 | + $shape->setHeight(100); |
| 20 | + $shape->setWidth(600); |
| 21 | + $shape->setOffsetX(100); |
| 22 | + $shape->setOffsetY(100); |
| 23 | + $shape->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT); |
| 24 | + |
| 25 | + $textRun = $shape->createTextRun('RichText with'); |
| 26 | + $textRun->getFont()->setBold(true); |
| 27 | + $textRun->getFont()->setSize(28); |
| 28 | + $textRun->getFont()->setColor(new Color('FF000000')); |
| 29 | + |
| 30 | + $shape->createBreak(); |
| 31 | + |
| 32 | + $textRun = $shape->createTextRun('Multiline'); |
| 33 | + $textRun->getFont()->setBold(true); |
| 34 | + $textRun->getFont()->setSize(60); |
| 35 | + $textRun->getFont()->setColor(new Color('FF000000')); |
| 36 | +} |
| 37 | + |
| 38 | +function fnSlideRichTextLineSpacing(PhpPresentation $objPHPPresentation) |
| 39 | +{ |
| 40 | + // Create templated slide |
| 41 | + echo date('H:i:s') . ' Create templated slide' . EOL; |
| 42 | + $currentSlide = createTemplatedSlide($objPHPPresentation); |
| 43 | + |
| 44 | + // Create a shape (text) |
| 45 | + echo date('H:i:s') . ' Create a shape (rich text) with line spacing (100)' . EOL; |
| 46 | + $shape = $currentSlide->createRichTextShape(); |
| 47 | + $shape->setHeight(100); |
| 48 | + $shape->setWidth(400); |
| 49 | + $shape->setOffsetX(100); |
| 50 | + $shape->setOffsetY(100); |
| 51 | + $shape->getActiveParagraph()->setLineSpacing(100); |
| 52 | + |
| 53 | + $shape->createTextRun('RichText with'); |
| 54 | + $shape->createBreak(); |
| 55 | + $shape->createTextRun('Line Spacing 100'); |
| 56 | + |
| 57 | + // Create a shape (text) |
| 58 | + echo date('H:i:s') . ' Create a shape (rich text) with line spacing (200)' . EOL; |
| 59 | + $shape = $currentSlide->createRichTextShape(); |
| 60 | + $shape->setHeight(100); |
| 61 | + $shape->setWidth(400); |
| 62 | + $shape->setOffsetX(100); |
| 63 | + $shape->setOffsetY(200); |
| 64 | + $shape->getActiveParagraph()->setLineSpacing(200); |
| 65 | + |
| 66 | + $shape->createTextRun('RichText with'); |
| 67 | + $shape->createBreak(); |
| 68 | + $shape->createTextRun('Line Spacing 200'); |
| 69 | + |
| 70 | + // Create a shape (text) |
| 71 | + echo date('H:i:s') . ' Create a shape (rich text) with line spacing (300)' . EOL; |
| 72 | + $shape = $currentSlide->createRichTextShape(); |
| 73 | + $shape->setHeight(100); |
| 74 | + $shape->setWidth(400); |
| 75 | + $shape->setOffsetX(100); |
| 76 | + $shape->setOffsetY(300); |
| 77 | + $shape->getActiveParagraph()->setLineSpacing(300); |
| 78 | + |
| 79 | + $shape->createTextRun('RichText with'); |
| 80 | + $shape->createBreak(); |
| 81 | + $shape->createTextRun('Line Spacing 300'); |
35 | 82 | }
|
36 | 83 |
|
37 |
| -function fnSlideRichTextShadow(PhpPresentation $objPHPPresentation) { |
| 84 | +function fnSlideRichTextShadow(PhpPresentation $objPHPPresentation) |
| 85 | +{ |
38 | 86 | // Create templated slide
|
39 |
| - echo date('H:i:s') . ' Create templated slide'.EOL; |
| 87 | + echo date('H:i:s') . ' Create templated slide' . EOL; |
40 | 88 | $currentSlide = createTemplatedSlide($objPHPPresentation);
|
41 | 89 |
|
42 | 90 | // Create a shape (text)
|
43 |
| - echo date('H:i:s') . ' Create a shape (rich text) with shadow'.EOL; |
| 91 | + echo date('H:i:s') . ' Create a shape (rich text) with shadow' . EOL; |
44 | 92 | $shape = $currentSlide->createRichTextShape();
|
45 |
| - $shape->setHeight(100); |
46 |
| - $shape->setWidth(400); |
47 |
| - $shape->setOffsetX(100); |
48 |
| - $shape->setOffsetY(100); |
49 |
| - $shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_LEFT ); |
| 93 | + $shape->setHeight(100); |
| 94 | + $shape->setWidth(400); |
| 95 | + $shape->setOffsetX(100); |
| 96 | + $shape->setOffsetY(100); |
| 97 | + $shape->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT); |
50 | 98 | $shape->getShadow()->setVisible(true)->setAlpha(75)->setBlurRadius(2)->setDirection(45);
|
51 | 99 |
|
52 | 100 | $textRun = $shape->createTextRun('RichText with shadow');
|
53 |
| - $textRun->getFont()->setColor(new Color( 'FF000000' )); |
| 101 | + $textRun->getFont()->setColor(new Color('FF000000')); |
| 102 | +} |
| 103 | + |
| 104 | +function fnSlideRichTextList(PhpPresentation $objPHPPresentation) |
| 105 | +{ |
| 106 | + // Create templated slide |
| 107 | + echo date('H:i:s') . ' Create templated slide' . EOL; |
| 108 | + $currentSlide = createTemplatedSlide($objPHPPresentation); |
| 109 | + |
| 110 | + // Create a shape (text) |
| 111 | + echo date('H:i:s') . ' Create a shape (rich text) with list with red bullet' . EOL; |
| 112 | + $shape = $currentSlide->createRichTextShape(); |
| 113 | + $shape->setHeight(100); |
| 114 | + $shape->setWidth(400); |
| 115 | + $shape->setOffsetX(100); |
| 116 | + $shape->setOffsetY(100); |
| 117 | + $shape->getActiveParagraph()->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET)->setBulletColor(new Color(Color::COLOR_RED)); |
| 118 | + |
| 119 | + $shape->createTextRun('Alpha'); |
| 120 | + $shape->createParagraph()->createTextRun('Beta'); |
| 121 | + $shape->createParagraph()->createTextRun('Delta'); |
| 122 | + $shape->createParagraph()->createTextRun('Epsilon'); |
54 | 123 | }
|
55 | 124 |
|
56 | 125 | // Create new PHPPresentation object
|
57 |
| -echo date('H:i:s') . ' Create new PHPPresentation object'.EOL; |
| 126 | +echo date('H:i:s') . ' Create new PHPPresentation object' . EOL; |
58 | 127 | $objPHPPresentation = new PhpPresentation();
|
59 | 128 |
|
60 | 129 | // Set properties
|
61 |
| -echo date('H:i:s') . ' Set properties'.EOL; |
| 130 | +echo date('H:i:s') . ' Set properties' . EOL; |
62 | 131 | $oProperties = $objPHPPresentation->getDocumentProperties();
|
63 | 132 | $oProperties->setCreator('PHPOffice')
|
64 |
| - ->setLastModifiedBy('PHPPresentation Team') |
65 |
| - ->setTitle('Sample 11 Title') |
66 |
| - ->setSubject('Sample 11 Subject') |
67 |
| - ->setDescription('Sample 11 Description') |
68 |
| - ->setKeywords('office 2007 openxml libreoffice odt php') |
69 |
| - ->setCategory('Sample Category'); |
| 133 | + ->setLastModifiedBy('PHPPresentation Team') |
| 134 | + ->setTitle('Sample 11 Title') |
| 135 | + ->setSubject('Sample 11 Subject') |
| 136 | + ->setDescription('Sample 11 Description') |
| 137 | + ->setKeywords('office 2007 openxml libreoffice odt php') |
| 138 | + ->setCategory('Sample Category'); |
70 | 139 |
|
71 | 140 | // Remove first slide
|
72 |
| -echo date('H:i:s') . ' Remove first slide'.EOL; |
| 141 | +echo date('H:i:s') . ' Remove first slide' . EOL; |
73 | 142 | $objPHPPresentation->removeSlideByIndex(0);
|
74 | 143 |
|
75 | 144 | fnSlideRichText($objPHPPresentation);
|
| 145 | +fnSlideRichTextLineSpacing($objPHPPresentation); |
76 | 146 | fnSlideRichTextShadow($objPHPPresentation);
|
| 147 | +fnSlideRichTextList($objPHPPresentation); |
77 | 148 |
|
78 | 149 | // Save file
|
79 | 150 | echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers);
|
80 | 151 | if (!CLI) {
|
81 |
| - include_once 'Sample_Footer.php'; |
| 152 | + include_once 'Sample_Footer.php'; |
82 | 153 | }
|
0 commit comments