Skip to content

Commit e373315

Browse files
committed
Tweak samples and initiate documentation
1 parent 4c944f3 commit e373315

File tree

10 files changed

+124
-16
lines changed

10 files changed

+124
-16
lines changed

Documentation/PHPPowerPoint Manual.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# PHPPowerPoint
2+
3+
PHPPowerPoint is a library written in pure PHP that provides a set of classes to write to and read from different presentation file formats. PHPPowerPoint is an open source project licensed under LGPL.
4+
5+
### Features
6+
7+
- Create an in-memory presentation representation
8+
- Set presentation meta data (author, title, description, etc)
9+
- Add slides from scratch or from existing one
10+
- Supports different fonts and font styles
11+
- Supports different formatting, styles, fills, gradients
12+
- Supports hyperlinks and rich-text strings
13+
- Add images with different styles (positioning, rotation, shadow)
14+
- Set printing options (header, footer, page margins, paper size, orientation)
15+
- Output to different file formats: PowerPoint 2007 (.pptx), OpenDocument Presentation (.odp), Serialized Spreadsheet)
16+
- ... and lots of other things!
17+
18+
### Requirements
19+
20+
The following requirements should be met prior to using PHPPowerPoint:
21+
22+
- PHP version 5.2 or higher
23+
- PHP extension php_zip enabled
24+
- PHP extension php_xml enabled
25+
26+
### Installation
27+
28+
To install and use PHPPowerPoint, copy the contents of the `Classes` folder and include `PHPPowerPoint.php` somewhere in your code like below.
29+
30+
```php
31+
include_once '/path/to/Classes/PHPPowerPoint.php';
32+
```
33+
34+
After that, you can use the library by creating a new instance of the class.
35+
36+
```php
37+
$phpPowerPoint = new PHPPowerPoint();
38+
```
39+
40+
## Usages
41+
42+
### Document properties
43+
44+
Use `getProperties` method to set document properties or metadata like author name and presentation title like below.
45+
46+
```php
47+
$phpPowerPoint = new PHPPowerPoint();
48+
$properties = $phpPowerPoint->getProperties();
49+
$properties->setTitle('My presentation');
50+
```
51+
52+
Available methods for setting document properties are:
53+
54+
- `setCategory`
55+
- `setCompany`
56+
- `setCreated`
57+
- `setCreator`
58+
- `setDescription`
59+
- `setKeywords`
60+
- `setLastModifiedBy`
61+
- `setModified`
62+
- `setSubject`
63+
- `setTitle`
64+
65+
### Slides
66+
67+
Slides are pages in a presentation. Slides are stored as a zero based array in `PHPPowerPoint` object. Use `createSlide` to create a new slide and retrieve the slide for other operation such as creating shapes for that slide.
68+
69+
```php
70+
$slide = $phpPowerPoint->createSlide();
71+
$shape = $slide->createRichTextShape();
72+
```
73+
74+
### Shapes
75+
76+
Shapes are objects that can be added to a slide. There are five types of shapes that can be used, i.e. rich text, line, chart, drawing, and table.
77+
78+
```php
79+
$richText = $slide->createRichTextShape();
80+
$line = $slide->createLineShape();
81+
```
82+
83+
Below are the methods of slide that can be used to create shapes.
84+
85+
- `createRichTextShape`
86+
- `createLineShape`
87+
- `createChartShape`
88+
- `createDrawingShape`
89+
- `createTableShape`
90+
91+
#### Rich text
92+
93+
#### Line
94+
95+
#### Chart
96+
97+
#### Drawing
98+
99+
#### Table
100+
101+
### Styles
102+
103+
- Alignment
104+
- Border
105+
- Bullet
106+
- Color
107+
- Fill
108+
- Font
7.06 KB
Loading

Examples/01simple.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
$shape = $currentSlide->createDrawingShape();
6666
$shape->setName('PHPPowerPoint logo')
6767
->setDescription('PHPPowerPoint logo')
68-
->setPath('./images/phppowerpoint_logo.gif')
68+
->setPath('./resources/phppowerpoint_logo.gif')
6969
->setHeight(36)
7070
->setOffsetX(10)
7171
->setOffsetY(10);

Examples/02presentation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ function createTemplatedSlide(PHPPowerPoint $objPHPPowerPoint){
244244
$slide->createDrawingShape()
245245
->setName('Background')
246246
->setDescription('Background')
247-
->setPath('./images/realdolmen_bg.jpg')
247+
->setPath('./resources/realdolmen_bg.jpg')
248248
->setWidth(950)
249249
->setHeight(720)
250250
->setOffsetX(0)
@@ -254,7 +254,7 @@ function createTemplatedSlide(PHPPowerPoint $objPHPPowerPoint){
254254
$slide->createDrawingShape()
255255
->setName('PHPPowerPoint logo')
256256
->setDescription('PHPPowerPoint logo')
257-
->setPath('./images/phppowerpoint_logo.gif')
257+
->setPath('./resources/phppowerpoint_logo.gif')
258258
->setHeight(40)
259259
->setOffsetX(10)
260260
->setOffsetY(720 - 10 - 40);

Examples/03serialized.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
$shape = $currentSlide->createDrawingShape();
5959
$shape->setName('PHPPowerPoint logo')
6060
->setDescription('PHPPowerPoint logo')
61-
->setPath('./images/phppowerpoint_logo.gif')
61+
->setPath('./resources/phppowerpoint_logo.gif')
6262
->setHeight(36)
6363
->setOffsetX(10)
6464
->setOffsetY(10);

Examples/05templated.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
$shape = $currentSlide->createDrawingShape();
5959
$shape->setName('PHPPowerPoint logo')
6060
->setDescription('PHPPowerPoint logo')
61-
->setPath('./images/phppowerpoint_logo.gif')
61+
->setPath('./resources/phppowerpoint_logo.gif')
6262
->setHeight(36)
6363
->setOffsetX(10)
6464
->setOffsetY(10);

Examples/07chart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ function createTemplatedSlide(PHPPowerPoint $objPHPPowerPoint)
256256
$slide->createDrawingShape()
257257
->setName('PHPPowerPoint logo')
258258
->setDescription('PHPPowerPoint logo')
259-
->setPath('./images/phppowerpoint_logo.gif')
259+
->setPath('./resources/phppowerpoint_logo.gif')
260260
->setHeight(40)
261261
->setOffsetX(10)
262262
->setOffsetY(720 - 10 - 40);

Examples/08chart.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* @category PHPPowerPoint
2222
* @package PHPPowerPoint
2323
* @copyright Copyright (c) 2009 - 2010 PHPPowerPoint (http://www.codeplex.com/PHPPowerPoint)
24-
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
24+
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
2525
* @version ##VERSION##, ##DATE##
2626
*/
2727

@@ -44,12 +44,12 @@
4444
// Set properties
4545
echo date('H:i:s') . " Set properties\n";
4646
$objPHPPowerPoint->getProperties()->setCreator("Maarten Balliauw")
47-
->setLastModifiedBy("Maarten Balliauw")
48-
->setTitle("Office 2007 PPTX Test Document")
49-
->setSubject("Office 2007 PPTX Test Document")
50-
->setDescription("Test document for Office 2007 PPTX, generated using PHP classes.")
51-
->setKeywords("office 2007 openxml php")
52-
->setCategory("Test result file");
47+
->setLastModifiedBy("Maarten Balliauw")
48+
->setTitle("Office 2007 PPTX Test Document")
49+
->setSubject("Office 2007 PPTX Test Document")
50+
->setDescription("Test document for Office 2007 PPTX, generated using PHP classes.")
51+
->setKeywords("office 2007 openxml php")
52+
->setCategory("Test result file");
5353

5454
// Remove first slide
5555
echo date('H:i:s') . " Remove first slide\n";
@@ -159,14 +159,14 @@
159159
*/
160160
function createTemplatedSlide(PHPPowerPoint $objPHPPowerPoint)
161161
{
162-
// Create slide
163-
$slide = $objPHPPowerPoint->createSlide();
162+
// Create slide
163+
$slide = $objPHPPowerPoint->createSlide();
164164

165165
// Add logo
166166
$slide->createDrawingShape()
167167
->setName('PHPPowerPoint logo')
168168
->setDescription('PHPPowerPoint logo')
169-
->setPath('./images/phppowerpoint_logo.gif')
169+
->setPath('./resources/phppowerpoint_logo.gif')
170170
->setHeight(40)
171171
->setOffsetX(10)
172172
->setOffsetY(720 - 10 - 40);

0 commit comments

Comments
 (0)