Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

powerpoints need repairing. #266

Closed
pgee70 opened this issue Sep 15, 2016 · 10 comments
Closed

powerpoints need repairing. #266

pgee70 opened this issue Sep 15, 2016 · 10 comments

Comments

@pgee70
Copy link
Contributor

pgee70 commented Sep 15, 2016

Hi this may be similar to #89
Every powerpoint I make needs to be repaired when opened by powerpoint.
It isn't just the ones that i have made for my own work it is also the sample folder versions.

I used composer to get "phpoffice/phppresentation": "dev-master"
I have run the simple sample 1 file. (this is the test-case but all files i create require repairing)

I have tried OpenXML SDK2.5 productivity tool by microsoft and it states there is no problem with the pptx.
I have tried opening with: powerpoint mac v 15.26, powerpoint mac 14.6.7, windows 10 office 2013 powerpoint, keynote refuses to open the file, libreoffice opens it without complaints.
When the files are opened there are no visible issues.

for reference i have enc. a link to the file i have created. i hadn't changed the default sample files.
except to make a 'results' folder with write permissions.

Its probably a setup thing, but any help/suggestions would be appreciated.

Sample_01_Simple.pptx

I went ahead and wiped the installation and re-installed it. i had to change the path of require_once DIR . '/../vendor/autoload.php'; on Sample_Header.php to get the samples to work. But still had the same issue.
The ODP format doesn't have this issue.

@alejandrososa
Copy link

Good afternoon, the same goes for me.

@ghost
Copy link

ghost commented Sep 16, 2016

I'm having the same issue - both Sample_01_Simple and Sample_01_Complex require repairs when opened with PowerPoint For Mac 15.17.

@peder-andfrankly
Copy link

Getting the same error; see example PPT generated that fails.
&frankly_2016-09-28_13.12.28.pptx

@ghost
Copy link

ghost commented Sep 28, 2016

I ended up needing to do some custom work for my project that went outside the scope of this plugin - I ran into this same issue when I failed to compress the powerpoint's XML appropriately. Maybe the plugin (or these examples) are including the parent file or doing non-zero compression when the edited files are re-archived?

Usually a corrupted element will yield an alert along the lines of "Unreadable elements were deleted", so this seems more likely to be a compression/file formatting issue.

@ryanhattam
Copy link

Hi

I spent a fair bit of time investigating this, and found the cause.
Prior to commit 5de5693, the pptslide writer (PHPPresentation/src/PhpPresentation/Writer/PowerPoint2007/PptSlides.php)
would always write a 'slideLayout' relationship, essentially hard coded on every slide.

In the referenced commit, and subsequent ones, a change was made so that a layout would only be added to a slide if one was specified. If no layout is explicitly set on the slide, it won't get one, and powerpoint will complain, saying it needs to repair the presentation.

The change in that commit was actually a breaking change. Either the old behavior needs to be applied if no layout was specified for a slide, a slide should get a default layout on creation, or building the presentation should fail with an error shown to the user.

As we use a slide generation 'wrapper' I opted to add a default layout to each slide in the wrapper.

Hope this helps someone, and helps the devs fix the issue. Sorry I can't provide a pull request.

@peder-andfrankly
Copy link

peder-andfrankly commented Sep 29, 2016

@ryanhattam Many thanks for this! It solved our problem. Don't have possibility to provide a PR either, but the following code that just sets a default layout for every slide we create works to avoid/workaround these issues.

$objPHPPowerPoint = new PhpPresentation();

$oMasterSlide = $objPHPPowerPoint->getAllMasterSlides()[0];

$oSlideLayout = $oMasterSlide->getAllSlideLayouts()[0];

...
// Set layout for first slide

$currentSlide = $objPHPPowerPoint->getActiveSlide();

$currentSlide->setSlideLayout($oSlideLayout);

...
// Set layout for any new slide we create

$currentSlide = $objPHPPowerPoint->createSlide();

$currentSlide->setSlideLayout($oSlideLayout);

@Progi1984
Copy link
Member

@pgee70 @alejandrososa @JakeSamson @peder-andfrankly @ryanhattam : Could you test the last version of the develop branch ? @jrking4 has fixed its version for PowerPoint for Mac

@dophil
Copy link

dophil commented Nov 26, 2016

hello,

I just created another issue because .gif cause issue on PowerPoint Mac. I don't know if there is a relation.

regards

philippe

Progi1984 added a commit to Progi1984/PHPPresentation that referenced this issue Dec 23, 2016
@Progi1984
Copy link
Member

@dophil Could you test this PR #303 ? Please and thanks for advance

Progi1984 added a commit to Progi1984/PHPPresentation that referenced this issue Dec 25, 2016
Progi1984 added a commit that referenced this issue Jan 9, 2017
#266 : PowerPoint2007 Writer : Fix for Need repair
@Progi1984
Copy link
Member

@pgee70 @dophil @peder-andfrankly @alejandrososa @JakeSamson @ryanhattam The PR #303 has been merged in develop branch. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants