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

Presentations break with version 2309 of PowerPoint #758

Closed
jesseg-traqline opened this issue Sep 20, 2023 · 24 comments · Fixed by #770
Closed

Presentations break with version 2309 of PowerPoint #758

jesseg-traqline opened this issue Sep 20, 2023 · 24 comments · Fixed by #770
Milestone

Comments

@jesseg-traqline
Copy link

With update version 2309 (Build 16827.20056 Click-to-Run) of Microsoft Office 365, any presentation that includes a chart object will show up as corrupted. In some cases, any page containing a chart will be replaced with a blank slide. In other cases, the presentation will fail to open completely.

A coworker with an earlier version, 2307 (Build 16626.20170 Click-to-Run), reported that the presentations worked just fine, so I tried rolling back. When I did, the presentations opened fine for me as well, with all slides and charts intact.

Rolling back and pausing Microsoft Office updates may work as a temporary internal short term fix, but presentations made with PHPPresentation need to be compatible with the latest and future versions of Microsoft Office.

MySandbox.pptx
I have created and attached a sample presentation that demonstrates the problem and contains no proprietary information:

  • If opened with version 2309, slides 2 and 3 should show up as corrupt and be blanked. Slides 1 and 4 should remain intact.
  • If opened with version 2307 or earlier, all 4 slides should remain intact.
@Brenneisen
Copy link
Contributor

@Progi1984 We have the same problem. Is there a way to get the error message from PowerPoint to understand where the problem is coming from? Is there a way to verify the XML output?

@Progi1984
Copy link
Member

I understand that you are on the preview channel.

I check updates from Microsoft : https://learn.microsoft.com/en-us/officeupdates/current-channel-preview.
Nothing about charts/openxml in 2308 or 2309.

Like it's an insider program, we should wait next versions.

@Brenneisen
Copy link
Contributor

Brenneisen commented Sep 20, 2023

In our case it is the current version 16.77 (23091001) on Mac (installed from the App Store) and also the online version of Microsoft 365 (https://view.officeapps.live.com/op/view.aspx?src={URL_TO_FILE}).

@Brenneisen
Copy link
Contributor

@Progi1984 Do you have any ideas? The Mac version of PowerPoint is the current stable one. I don't know the version of the online PowerPoint version. But it used to work there, too, and now it doesn't. Pie charts seem to work, bar charts don't. Is there a way to get the error message from PowerPoint to understand where the problem is coming from?

@Progi1984
Copy link
Member

Which version of PhpPresentation do you use ?

Could you send me a file who run well before and is broken now ?

@jesseg-traqline
Copy link
Author

Which version of PhpPresentation do you use ?

Could you send me a file who run well before and is broken now ?

Version 0.6.0. This issue is affecting both newly generated files and files that were generated years ago.

The example file is linked in the OP.

@WFarmerEthisphere
Copy link
Contributor

We are seeing the same issue as well, and we are using the latest version of PhpPresentation.

@Brenneisen
Copy link
Contributor

Hi @Progi1984, we use the latest stable version of the framework (1.0). The current development version does not work too.

@WFarmerEthisphere
Copy link
Contributor

WFarmerEthisphere commented Sep 29, 2023

You can better replicate this if you try to create a chart:

        $shape = $slide->createChartShape();
        $shape->setName('Chart')
            ->setResizeProportional(false);
        $shape->getPlotArea()->setType($barChart);

You'll see that the chart doesn't show up, and it'll ask to repair the powerpoint, which doesn't really repair anything.

@ErikBernskiold
Copy link

ErikBernskiold commented Oct 4, 2023

Echoing this experience. Came here to troubleshoot why users of one of the applications we manage suddenly started reporting PowerPoints being broken. Using the latest dev version PHP Presentation.

Also confirming that the same problem exists for both new and old PowerPoints in this version.

Based on when volumes of reports started coming in, I'd say it is the most recent versions. My computer was running 16.77 which I installed on 20 sept, and experiencing the issue.

I'm no PowerPoint coding expert (I rather dislike the repair errors because they are so tedious to troubleshoot...) so not sure if there is a way to better find out what it doesn't like. But it does seem to be a bug in PPT. :(

@rappasoft
Copy link

Yeah, this is really putting a damper on my projects. We're trying to figure out a solution now. It's just slides with charts that are broken.

@ErikBernskiold
Copy link

Just switched to the beta track on Mac to confirm that the problem is still there in 16.79.23100109

@crs-snap
Copy link

crs-snap commented Oct 5, 2023

Confirm that powerpoint Version 2309 Build 16.0.16827.20130 will not open pptx's with charts in them (at least bar charts) that have been generated with PHPPresentation.

@travhow99
Copy link

+1 same issue here on both Mac & Windows versions of PowerPoint with newly generated powerpoints and powerpoints > 1 year old, all with charts as @WFarmerEthisphere mentioned. Though mine won't even open now after attempting to repair it and Powerpoint says Powerpoint can't read the file.

@WFarmerEthisphere
Copy link
Contributor

WFarmerEthisphere commented Oct 6, 2023

Here is a simple script to reproduce the issue:

<?php

require_once 'vendor/autoload.php';

use PhpOffice\PhpPresentation\PhpPresentation;
use PhpOffice\PhpPresentation\IOFactory;
use PhpOffice\PhpPresentation\Shape\Chart\Type\Bar;
use PhpOffice\PhpPresentation\Shape\Chart\Series;
use PhpOffice\PhpPresentation\Shape\Chart\Title;

// Create a new presentation
$presentation = new PhpPresentation();

// Remove the default slide
$presentation->removeSlideByIndex(0);

// Create a new slide
$slide = $presentation->createSlide();

// Chart data
$seriesData = [
    'Category 1' => 1,
    'Category 2' => 4,
    'Category 3' => 3,
    'Category 4' => 2
];

// Create a bar chart
$barChart = new Bar();

$series = new Series('Sample Series', $seriesData);
$series->getFont()->setBold(true);

$barChart->addSeries($series);

// Add chart to slide
$shape = $slide->createChartShape();
$shape->setName('Simple Bar Chart')
    ->setResizeProportional(false)
    ->setWidth(600)
    ->setHeight(400)
    ->setOffsetX(100)
    ->setOffsetY(100);

$shape->getTitle()->setText('Basic Bar Chart');
$shape->getPlotArea()->setType($barChart);

// Save the presentation
$oWriterPPTX = IOFactory::createWriter($presentation, 'PowerPoint2007');
$oWriterPPTX->save("SimpleBarChartPresentation.pptx");

echo "Presentation created successfully!\n";

Run this locally, open SimpleBarChartPresentation in a MS Office version > 2309 and you'll see the error.

I haven't found exactly where in the BarChart the error persists, sadly. I do know if you comment out the bar chart, the presentation opens with a blank slide and no repairs needed.

@ErikBernskiold
Copy link

ErikBernskiold commented Oct 6, 2023

Adding two things that may help with troubleshooting:

Opening a presentation in LibreOffice and saving it back to a .pptx makes at least my broken presentations work again in PowerPoint...

However, opening the Powerpoint in Apple Keynote, the graphs are missing (although Keynote doesn't report it as broken). Although I don't know if that ever worked before...

@Scheissy
Copy link
Contributor

Scheissy commented Oct 6, 2023

looks like the axis have the wrong formatCode setting. the default value seems to be an empty string, but the value needs to be set to General.

i added the following 2 lines to the script provided by @WFarmerEthisphere:

$shape->getPlotArea()->getAxisX()->setFormatCode('General');
$shape->getPlotArea()->getAxisY()->setFormatCode('General');

needs confirmation if it works for all chart types or just the bar chart!!!

@ErikBernskiold
Copy link

Nice find @Scheissy! Confirming this works for bar, line and scatter.

@WFarmerEthisphere
Copy link
Contributor

Just confirmed on my end that @Scheissy's fix works. Thanks!

@travhow99
Copy link

@Scheissy 's fix worked for me as well, thank you very much!

@WFarmerEthisphere
Copy link
Contributor

PR created to fix this here:
#761

@rasikkunwar
Copy link

Thanks for the solution. It fixed the issue. I was having issue with doughnut chart too. I put these lines of code, and it works for doughnut chart too.

So, this solution is working for line, area, bar and doughnut.

@ioguimaraes
Copy link

@Scheissy Nice shoot. My users app reported this bug last weekend, thanks for the solution!!!!

@mohamadt94
Copy link

@Scheissy Wonderfull , works for me and solve my problem

@Progi1984 Progi1984 added this to the 1.1.0 milestone Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.