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

Layout information is lost for added slides #5

Open
jschiedt opened this issue Oct 6, 2020 · 10 comments
Open

Layout information is lost for added slides #5

jschiedt opened this issue Oct 6, 2020 · 10 comments
Labels
bug Something isn't working

Comments

@jschiedt
Copy link

jschiedt commented Oct 6, 2020

I open a pptx with a layout containing a background image using
$basePPTX = new PPTX($path1);
and save it
$basePPTX->saveAs($path2);

everything is fine.

I add the same pptx again:
$endPPTX = new PPTX($path1);
$basePPTX->addSlides($endPPTX->getSlides());

I get a message, if I want to repair the pptx, then I get a message, that certain slides cannot be displayed. for other slides no layout exists.

if I add different presentations I get the same messages, but only layouts are missing for the added slides.

do you have any idea?

@TZK-
Copy link
Member

TZK- commented Oct 7, 2020

We've added bug report issue template to ease helping.
Can you edit your message to follow the new template ?

Thanks

@jschiedt
Copy link
Author

PHP-Code:
$basePPTX = new PPTX('/var/www/html/test.pptx');
$endPPTX = new PPTX('/var/www/html/test.pptx');
$basePPTX->addSlides($endPPTX->getSlides());
$basePPTX->saveAs('/var/www/html/result.pptx');

PPTX-Files:
test.pptx
result.pptx

Expected behavior:
PPTX will open and display 4 slides

Actual behavior:
Error message when opening file:
Bildschirmfoto 2020-10-12 um 14 03 19

Error message after klicking on yes (repair file)
Bildschirmfoto 2020-10-12 um 14 03 56

Added slides have no background:
Bildschirmfoto 2020-10-12 um 14 04 17

Linux 3.10.0-693.11.6.el7.x86_64 #1 SMP Thu Jan 4 01:06:37 UTC 2018 x86_64
PHP Version 7.1.33
PowerPoint2007

@alexcrowdhub
Copy link

Has anyone found a resolution to this issue? Currently seeing the same thing

@abarrett86
Copy link

@TZK- Have you been able to look into this issue?

@camillebaronnet camillebaronnet added the bug Something isn't working label Nov 30, 2020
@camillebaronnet
Copy link
Member

@TZK- and I don't have enough time to fix this problem as quickly as possible. Any help is welcome

@abarrett86
Copy link

Thank you for your response; do you have any idea what would cause this issue? I'm searching for a solution now but any clues would be appreciated

@camillebaronnet
Copy link
Member

Thank you too,

Maybe the file reference (.rels) is missing in an XML file. Sometimes it is possible to repair the PPTX generated with Powerpoint. In this case it' s interesting to compare the file fixed by powerpoint with the one generated by the lib.

Also, to prevent some incompatibility, we have deliberately blocked the copy of certain reference, it is perhaps this one that poses a problem today.

Have a look at /Presentation/Resource/Presentation.php and /Presentation/Resource/Slide.php at 155.

Thank you in advance

@jbreitenthaler
Copy link

I am currently experiencing the same problem, has anybody made some progress yet?

One thing I already discovered when comparing the version of the file that Powerpoint fixed with the original merged file, was the very different assignment of rIDs. Another thing which does not work on my machine is the generation of unique IDs for the master slides (too big for 32-bit integer, floats do not seem to work), anybody else had that problem in this context?

@abarrett86
Copy link

I couldn't find any fixed by editing the library files, but what did work for me is to open the source ppt file in powerpoint and run the File > Inspect option, then fix anything it found. This included : removing notes by clicking the remove button on the tool, removing external documents (most often by rasterizing charts and using a picture rather than the actual chart), removing hidden content by clicking the remove button on the tool. Once I did this everything seemed to work with the library.

A few additional notes:

  • this inspect option is only available on windows
  • some photo crop information is unable to be removed but didn't seem to cause any issues for me

Hope this helps, Good Luck!

@jbreitenthaler
Copy link

Thanks @abarrett86 but your solution did not work for us unfortunately.
I put in some work and compared the presentation fixed by Powerpoint with the generated one (simply merging two presentations with one empty slide each). I did the comparison by replacing the fixed files in the archive with the damaged ones one by one and these were the changes not accepted by Powerpoint (repair dialogue showing up again):

  • New MasterSlide IDs won't work on a 32-bit system the way it is implemented now (too big for a 32 bit Integer)
  • Powerpoint created a separate theme.xml file for the added set of master slides in the fix
  • The newly created theme.xml file is referenced in the added slideMaster.xml.rels file

I don't know if just referencing new slides to the original master is a possible feature, but adding a whole new set of master slides everytime slides are added to a presentation seems weird to me as with the features this library offers I think most people are going to want to merge PPTs with the same Master.

We are currently using a workaround which works fine but my company can not put the time in to fix the library code ourselves, but we would appreciate a fix in the near future so we can use your library as intended. @camillebaronnet @TZK-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants