These are chat archives for PHPOffice/PHPPresentation

1st
Sep 2017
dvdbot
@dvdbot
Sep 01 2017 13:44 UTC

Hey, when trying to run the following code:

require_once 'vendor/autoload.php';

use PhpOffice\PhpPresentation\IOFactory;
use PhpOffice\PhpPresentation\Slide;
use PhpOffice\PhpPresentation\Shape\RichText;

$pptReader = IOFactory::createReader('PowerPoint2007');
$oPHPPresentation = $pptReader->load('resources/Digital Signage.pptx');

$oTree = new PhpPptTree($oPHPPresentation);
echo $oTree->display();

I get an error about:

Fatal error: Uncaught Error: Class 'PhpPptTree' not found in \index.php:18 Stack trace: #0 {main} thrown in \index.php on line 18

Thomas Citharel
@tcitworld
Sep 01 2017 13:45 UTC
Is there anything inside vendor/ ?
dvdbot
@dvdbot
Sep 01 2017 13:45 UTC
Yes there is, I installed everything using Composer like said on this page: http://phppresentation.readthedocs.io/en/latest/installing.html#using-composer
Thomas Citharel
@tcitworld
Sep 01 2017 13:47 UTC
PhpPptTree should be imported.
Probably something like
use PhpOffice\PhpPresentation\PhpPptTree
Check the correct path inside the sources
dvdbot
@dvdbot
Sep 01 2017 13:48 UTC

code is now:

require_once 'vendor/autoload.php';

use PhpOffice\PhpPresentation\IOFactory;
use PhpOffice\PhpPresentation\Slide;
use PhpOffice\PhpPresentation\Shape\RichText;
use PhpOffice\PhpPresentation\PhpPptTree;

$pptReader = IOFactory::createReader('PowerPoint2007');
$oPHPPresentation = $pptReader->load('resources/Digital Signage.pptx');

$oTree = new PhpPptTree($oPHPPresentation);
echo $oTree->display();

Still getting error:

Fatal error: Uncaught Error: Class 'PhpOffice\PhpPresentation\PhpPptTree' not found in D:\Projects\PHPStorm\VosSignage\index.php:19 Stack trace: #0 {main} thrown in D:\Projects\PHPStorm\VosSignage\index.php on line 19

I'm using PHPStorm, that shouldn't be a problem, right?
For testing, it runs in AMPPS
dvdbot
@dvdbot
Sep 01 2017 13:51 UTC
I haven't included the sample_header because I thought it is just a simple header file
Thomas Citharel
@tcitworld
Sep 01 2017 13:51 UTC
Well, it's the one that does all the display stuff.
dvdbot
@dvdbot
Sep 01 2017 13:52 UTC
I'll try creating a header file
Thomas Citharel
@tcitworld
Sep 01 2017 13:52 UTC
PHPPresentation is just a object representing the presentation data, it doesn't have any methods or so to render itself.
dvdbot
@dvdbot
Sep 01 2017 13:52 UTC
Ah, good to know
Thomas Citharel
@tcitworld
Sep 01 2017 13:53 UTC
That's why in the sample there's this header file that's used in all samples.
dvdbot
@dvdbot
Sep 01 2017 13:56 UTC
Is it possible to actually show the presentation itself?
Thomas Citharel
@tcitworld
Sep 01 2017 13:57 UTC
Well, if you have exactly the same thing as the sample, yes.
dvdbot
@dvdbot
Sep 01 2017 13:57 UTC
It just shows a tree structure
Thomas Citharel
@tcitworld
Sep 01 2017 13:57 UTC
Maybe there's a better sample, but you have to work everything else, yeah
dvdbot
@dvdbot
Sep 01 2017 13:58 UTC
My goal is to actually play a powerpoint presentation, this is possible right?
Thomas Citharel
@tcitworld
Sep 01 2017 13:58 UTC
no
not that i know of
dvdbot
@dvdbot
Sep 01 2017 13:59 UTC
Oh I thought that PHPOfficePHPPresentation was made for that
My mistake
Thomas Citharel
@tcitworld
Sep 01 2017 14:00 UTC
PHPOffice is a toolbox / library to work with files, not a ready-to-use app
dvdbot
@dvdbot
Sep 01 2017 14:01 UTC
I know, but I thought it was capable of playing a powerpoint presentation with animations in the browser
Thomas Citharel
@tcitworld
Sep 01 2017 14:01 UTC
Nah. I wanted to work on that to import .ppt into Framaslides, but never got the time.
If you want animations in the browser and all that sort of stuff, checkout impress.js, but it's only html
dvdbot
@dvdbot
Sep 01 2017 14:02 UTC
Ah, thanks for your time then but this isn't what I'm looking for.
Thanks for the info, I'll take a look, have a nice day
Progi1984
@Progi1984
Sep 01 2017 14:10 UTC
@tcitworld Thanks for the support :)
Thomas Citharel
@tcitworld
Sep 01 2017 14:22 UTC
o/