PHPPresentation

 
 

PHP Class Library for Presentation Formats

What is PHPPresentation?

PHPPresentation is a collection of classes provided as an open-source PHP library that lets you perform read and write operations on different Microsoft PowerPoint and OpenOffice presentation file formats. Using PHPPresentation library, you can work with presentation slides, shapes, formatting styles, plain and 3D charts, slide comments and drawing objects.

Previous Next

Getting Started with PHPPresentation

To use PHPPresentation on your system, you need to install PHP version 5.1 or newer.  The recommended way to install the PHPPresentation library is through composer. Please add the following lines to your composer.json.

Here is the command

 {
    "require": {
       "phpoffice/phppresentation": "dev-master"
    }
}

Composer offers a convenient installer that you can execute directly from the command line. Feel free to download this file or review it on GitHub. There are two ways to install Composer. Install it locally as part of your project, or globally as a system-wide executable.

You can also manually install PHPPresentation by downloading the latest release from the Github releases page . Please do register the autoloader if you do not use composer in your project.

Customize Presentation Settings

PHPPresentation allows you to access and set various properties of presentations. Title, creator and company name can be configured. You can also configure if the presentation displays the comments or not. Similarly, you can also set the last view of the presentation, the thumbnail of the presentation, as well as the zoom value for the presentation. By using the following lines of code you can set Presentation Settings

Set Presentation Settings in PHP

  1. Initialize PhpPresentation
  2. Get PresentationProperties
  3. Enable display for the comments

Enable Display for Comments

$oPresentation = new PhpPresentation();
$oProperties = $oPresentation->getPresentationProperties();
// enable the display for comment
$oProperties->setCommentVisible(true);

Customize Slide Settings

PHPPresentation allows you to define the name of the slides. You can also make any slides visible or hidden within the presentation. You can add various type of shape objects to slides, such as rich-text, line, chart, drawing, and table. Furthermore, you can also configure the common properties and styles of these shapes. Multiple animations can be created on a slide. WMV and OGV video media can be embedded in slides for Microsoft Windows and Linux readers, respectively. RichText, drawing objects and tables can also be worked with using PHPPresentation.

Work with Charts and Styles

Using PHPPresentation you can create, customize and embed charts in slides. Both minor and major type of gridlines can be defined for the X and Y-axis. Also, you can configure the gridline width, its fill type and fill color. At the moment support is available for Bar Charts and 3D Bar Charts.