Skip to content

Commit 0441e2e

Browse files
committed
Merge branch 'develop' into featSlideVisible
2 parents 330a812 + 5764b5c commit 0441e2e

File tree

19 files changed

+660
-257
lines changed

19 files changed

+660
-257
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Bugfix
66
- Fixed the image project - @mvargasmoran GH-177
7+
- PowerPoint2007 Writer : Bugfix for printing slide notes - @JewrassicPark @Progi1984 GH-179
78

89
### Changes
910
- PhpOffice\PhpPresentation\Writer\ODPresentation : Move to Design Pattern Decorator - @Progi1984
@@ -22,6 +23,7 @@
2223
- ODPresentation & PowerPoint2007 & Serialized Writer : Support for Zip Adapter - @Progi1984 GH-176
2324
- ODPresentation & PowerPoint2007 Writer : language property to TextElement - @skrajewski & @Progi1984 GH-180
2425
- ODPresentation & PowerPoint2007 Writer : Add Font Support For Chart Axis - @jrking4 GH-186
26+
- ODPresentation & PowerPoint2007 Writer : Support for video - @Progi1984 GH-123
2527
- ODPresentation & PowerPoint2007 Writer : Support for Visibility for slides - @Progi1984
2628
- PowerPoint2007 Writer : Presentation with predefined View Type - @Progi1984 GH-120
2729

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ PHPPresentation is a library written in pure PHP that provides a set of classes
3434

3535
shapes_chart
3636
shapes_comment
37+
shapes_media
3738
shapes_richtext
3839
shapes_table
3940

docs/shapes.rst

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,11 @@ Example:
2727
->setOffsetX(170)
2828
->setOffsetY(180);
2929
30-
Rich text
31-
---------
32-
33-
The Rich text has :ref:`its own page <shapes_richtext>`.
34-
3530
Line
3631
----
3732

3833
To create a line, use `createLineShape` method of slide.
3934

40-
Chart
41-
-----
42-
43-
The Chart has :ref:`its own page <shapes_chart>`.
44-
45-
Comment
46-
-------
47-
48-
The Comment has :ref:`its own page <shapes_comment>`.
4935

5036
Drawing
5137
-------
@@ -58,8 +44,3 @@ To create a drawing, use `createDrawingShape` method of slide.
5844
$drawing->setName('Unique name')
5945
->setDescription('Description of the drawing')
6046
->setPath('/path/to/drawing.filename');
61-
62-
Table
63-
-----
64-
65-
The Table has :ref:`its own page <shapes_table>`.

docs/shapes_media.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.. _shapes_table:
2+
3+
Media
4+
=====
5+
6+
To create a video, create an object `Media`.
7+
8+
Example:
9+
10+
.. code-block:: php
11+
12+
use PhpOffice\PhpPresentation\Shape\Media;
13+
14+
$oMedia = new Media();
15+
$oMedia->setPath('file.mp4');
16+
// $oMedia->setPath('file.ogv');
17+
$oSlide->addShape($oMedia);
18+
19+
You can define text and date with setters.
20+
21+
Example:
22+
23+
.. code-block:: php
24+
25+
use PhpOffice\PhpPresentation\Shape\Media;
26+
27+
$oMedia = new Media();
28+
$oMedia->setName('Name of the Media');
29+
$oSlide->addShape($oMedia);
30+
31+
32+
Quirks
33+
------
34+
35+
For PowerPoint2007 Writer, the prefered file format is MP4.
36+
For ODPresentation Writer, the prefered file format is OGV.

samples/Sample_03_Image.php

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use PhpOffice\PhpPresentation\PhpPresentation;
66
use PhpOffice\PhpPresentation\Shape\Drawing;
7+
use PhpOffice\PhpPresentation\Shape\Media;
78
use PhpOffice\PhpPresentation\Shape\MemoryDrawing;
89

910
// Create new PHPPresentation object
@@ -24,13 +25,13 @@
2425
echo date('H:i:s') . ' Add a drawing to the slide'.EOL;
2526
$shape = new MemoryDrawing();
2627
$shape->setName('Sample image')
27-
->setDescription('Sample image')
28-
->setImageResource($gdImage)
29-
->setRenderingFunction(MemoryDrawing::RENDERING_JPEG)
30-
->setMimeType(MemoryDrawing::MIMETYPE_DEFAULT)
31-
->setHeight(36)
32-
->setOffsetX(10)
33-
->setOffsetY(10);
28+
->setDescription('Sample image')
29+
->setImageResource($gdImage)
30+
->setRenderingFunction(MemoryDrawing::RENDERING_JPEG)
31+
->setMimeType(MemoryDrawing::MIMETYPE_DEFAULT)
32+
->setHeight(36)
33+
->setOffsetX(10)
34+
->setOffsetY(10);
3435
$currentSlide->addShape($shape);
3536

3637
// Add a file drawing (GIF) to the slide
@@ -55,6 +56,18 @@
5556
->setOffsetY(200);
5657
$currentSlide->addShape($shape);
5758

59+
// Add a video to the slide
60+
$shape = new Media();
61+
$shape->setName('Video')
62+
->setDescription('Video')
63+
->setPath(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? './resources/sintel_trailer-480p.mp4' : './resources/sintel_trailer-480p.ogv')
64+
->setResizeProportional(false)
65+
->setHeight(90)
66+
->setWidth(90)
67+
->setOffsetX(10)
68+
->setOffsetY(300);
69+
$currentSlide->addShape($shape);
70+
5871
// Save file
5972
echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers);
6073
if (!CLI) {

samples/Sample_09_SlideNote.php

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,46 +11,51 @@
1111
// Create new PHPPresentation object
1212
echo date('H:i:s') . ' Create new PHPPresentation object' . EOL;
1313
$objPHPPresentation = new PhpPresentation();
14+
$oLayout = $objPHPPresentation->getLayout();
1415

1516
// Set properties
1617
echo date('H:i:s') . ' Set properties' . EOL;
17-
$objPHPPresentation->getProperties()->setCreator('PHPOffice')->setLastModifiedBy('PHPPresentation Team')->setTitle('Sample 01 Title')->setSubject('Sample 01 Subject')->setDescription('Sample 01 Description')->setKeywords('office 2007 openxml libreoffice odt php')->setCategory('Sample Category');
18+
$objPHPPresentation->getDocumentProperties()->setCreator('PHPOffice')->setLastModifiedBy('PHPPresentation Team')->setTitle('Sample 01 Title')->setSubject('Sample 01 Subject')->setDescription('Sample 01 Description')->setKeywords('office 2007 openxml libreoffice odt php')->setCategory('Sample Category');
1819

1920
// Create slide
2021
echo date('H:i:s') . ' Create slide' . EOL;
2122
$currentSlide = $objPHPPresentation->getActiveSlide();
2223

2324
// Create a shape (drawing)
24-
echo date('H:i:s') . ' Create a shape (drawing)'.EOL;
25+
echo date('H:i:s') . ' Create a shape (drawing)' . EOL;
2526
$shape = $currentSlide->createDrawingShape();
2627
$shape->setName('PHPPresentation logo')
27-
->setDescription('PHPPresentation logo')
28-
->setPath('./resources/phppowerpoint_logo.gif')
29-
->setHeight(36)
30-
->setOffsetX(10)
31-
->setOffsetY(10);
28+
->setDescription('PHPPresentation logo')
29+
->setPath('./resources/phppowerpoint_logo.gif')
30+
->setHeight(36)
31+
->setOffsetX(10)
32+
->setOffsetY(10);
3233
$shape->getShadow()->setVisible(true)
33-
->setDirection(45)
34-
->setDistance(10);
34+
->setDirection(45)
35+
->setDistance(10);
3536
$shape->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPresentation/')->setTooltip('PHPPresentation');
3637

3738
// Create a shape (text)
38-
echo date('H:i:s') . ' Create a shape (rich text)'.EOL;
39+
echo date('H:i:s') . ' Create a shape (rich text)' . EOL;
3940
$shape = $currentSlide->createRichTextShape()
4041
->setHeight(300)
4142
->setWidth(600)
4243
->setOffsetX(170)
4344
->setOffsetY(180);
44-
$shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER );
45+
$shape->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
4546
$textRun = $shape->createTextRun('Thank you for using PHPPresentation!');
4647
$textRun->getFont()->setBold(true)
47-
->setSize(60)
48-
->setColor( new Color( 'FFE06B20' ) );
48+
->setSize(60)
49+
->setColor(new Color('FFE06B20'));
4950

5051
// Set Note
5152
echo date('H:i:s') . ' Set Note' . EOL;
5253
$oNote = $currentSlide->getNote();
53-
$oRichText = $oNote->createRichTextShape()->setHeight(300)->setWidth(600)->setOffsetX(170)->setOffsetY(180);;
54+
$oRichText = $oNote->createRichTextShape()
55+
->setHeight($oLayout->getCY($oLayout::UNIT_PIXEL))
56+
->setWidth($oLayout->getCX($oLayout::UNIT_PIXEL))
57+
->setOffsetX(170)
58+
->setOffsetY(180);
5459
$oRichText->createTextRun('A class library');
5560
$oRichText->createParagraph()->createTextRun('Written in PHP');
5661
$oRichText->createParagraph()->createTextRun('Representing a presentation');
@@ -59,5 +64,5 @@
5964
// Save file
6065
echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers);
6166
if (!CLI) {
62-
include_once 'Sample_Footer.php';
67+
include_once 'Sample_Footer.php';
6368
}
4.17 MB
Binary file not shown.
12.4 MB
Binary file not shown.
-6.96 MB
Binary file not shown.

src/PhpPresentation/Shape/Media.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* This file is part of PHPPresentation - A pure PHP library for reading and writing
4+
* presentations documents.
5+
*
6+
* PHPPresentation is free software distributed under the terms of the GNU Lesser
7+
* General Public License version 3 as published by the Free Software Foundation.
8+
*
9+
* For the full copyright and license information, please read the LICENSE
10+
* file that was distributed with this source code. For the full list of
11+
* contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors.
12+
*
13+
* @link https://github.com/PHPOffice/PHPPresentation
14+
* @copyright 2009-2015 PHPPresentation contributors
15+
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
16+
*/
17+
18+
namespace PhpOffice\PhpPresentation\Shape;
19+
20+
use PhpOffice\PhpPresentation\ComparableInterface;
21+
22+
/**
23+
* Media element
24+
*/
25+
class Media extends Drawing implements ComparableInterface
26+
{
27+
}

0 commit comments

Comments
 (0)