-2

I've manually installed PhpPresentation from GitHub on Windows server 2008 (IIS 7) But when I run example from this installation - it does not work and show different errors. I managed to fix few errors. But right now it show error that I can not find on the Internet:

PhpOffice\PhpPresentation\ComparableInterface not found in ......\Color.php

How can I figure out what is wrong with installation and fix it?

Thank you

user3424840
  • 207
  • 2
  • 3
  • 8
  • Have you registered the autoloader? – Gino Pane Dec 29 '18 at 15:58
  • require_once 'C:\inetpub\wwwroot\classes\phpoffice\PHPPresentation\Autoloader.php'; #\phpoffice\PHPPresentation\Autoloader::register(); # for manual installation Autoloader::register(); # for manual installation – user3424840 Dec 30 '18 at 14:55
  • I try to use code above to register - but it show error Class "Autoloader" not found – user3424840 Dec 30 '18 at 14:56
  • require_once 'C:\inetpub\wwwroot\classes\phpoffice\PHPPresentation\Autoloader.php'; Autoloader::register(); – user3424840 Dec 30 '18 at 14:58
  • Also this file does exist and has class Autoloader with function register() – user3424840 Dec 30 '18 at 18:10
  • 'C:\inetpub\wwwroot\classes\phpoffice\PHPPresentation\Autoloader.php – user3424840 Dec 30 '18 at 18:10
  • Your paths seem wrong, they are different on https://github.com/PHPOffice/PHPPresentation. I'd suggest you to go with recommended composer installation, it should fix all issues. – Gino Pane Dec 30 '18 at 18:27
  • php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');" – user3424840 Jan 01 '19 at 01:42
  • I am trying to install composer with code above but it gives me error: Installer corrupt :-( – user3424840 Jan 01 '19 at 01:43
  • This was fixed when I use new version of composer installation :-) – user3424840 Jan 01 '19 at 15:00
  • Now try to run new 1st sample and it is working fine when run from command line but when I access it from browser - it show error below and output file is not generated. I added all permissions to folder 'results'... – user3424840 Jan 01 '19 at 15:04
  • Fatal error: Uncaught exception 'Exception' with message 'Could not close zip file C:\inetpub\wwwroot\samples/Sample_01_Simple.pptx.' in C:\inetpub\wwwroot\CLASS_PhpPresentation\vendor\phpoffice\common\src\Common\Adapter\Zip\ZipArchiveAdapter.php:36 Stack trace: #0 C:\inetpub\wwwroot\CLASS_PhpPresentation\vendor\phpoffice\phppresentation\src\PhpPresentation\Writer\PowerPoint2007.php(131): PhpOffice\Common\Adapter\Zip\ZipArchiveAdapter->close() #1 C:\inetpub\wwwroot\samples\Sample_Header.php(102): PhpOffice\PhpPresentation\Writer\PowerPoint2007->save('C:\\inetpub\\wwwr...') – user3424840 Jan 01 '19 at 15:04
  • #2 C:\inetpub\wwwroot\samples\Sample_01_Simple.php(58): write(Object(PhpOffice\PhpPresentation\PhpPresentation), 'Sample_01_Simpl...', Array) #3 {main} thrown in C:\inetpub\wwwroot\CLASS_PhpPresentation\vendor\phpoffice\common\src\Common\Adapter\Zip\ZipArchiveAdapter.php on line 36 – user3424840 Jan 01 '19 at 15:05
  • Cool, so you have a different error now. If you searched for solutions you probably saw this similar issue: https://stackoverflow.com/questions/21436949/phpexcel-writer-exception-with-message-could-not-close-zip-file-php-output. Or you'd better ask via "Issues" tab in PhpPresentation github repository instead. – Gino Pane Jan 01 '19 at 17:33
  • Thanks!!! Your comments are really helping :-) Now it generate pptx file with image from sample1 and it can be opened in PowerPoint – user3424840 Jan 01 '19 at 19:52
  • But there is one more problem - when this file is opened by PowerPoint it show some warning: PowerPoint found unreadable content in sample1.pptx. Do you want to recover the contents? When I click YES - file is shown... Is it possible to avoid it? – user3424840 Jan 01 '19 at 20:07
  • It is definitely better to ask this in the repository for that package, because it sounds like their specific issue. Happy New Year btw! :) – Gino Pane Jan 02 '19 at 09:47
  • Yes, it looks like it generate pptx for older version of PowerPoint and it can not be handled by new versions of PowerPoint... Happy New Year for you too :-) – user3424840 Jan 02 '19 at 14:26

1 Answers1

0

as described on Packagist, PhpPresentation depends on the PhpOffice\Common package :

https://github.com/PHPOffice/Common

So you download it and install it, and use it as :

include 'PhpOffice\PHPPresentation\Autoloader.php'; 
include 'PhpOffice\Common\Autoloader.php'; 
\PhpOffice\Common\Autoloader::register();
\PhpOffice\PHPPresentation\Autoloader::register();
Progi1984
  • 498
  • 3
  • 12