Giter Club home page Giter Club logo

Comments (24)

Scheissy avatar Scheissy commented on September 25, 2024 18

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!!!

from phppresentation.

WFarmerEthisphere avatar WFarmerEthisphere commented on September 25, 2024 2

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.

from phppresentation.

Brenneisen avatar Brenneisen commented on September 25, 2024

@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?

from phppresentation.

Progi1984 avatar Progi1984 commented on September 25, 2024

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.

from phppresentation.

Brenneisen avatar Brenneisen commented on September 25, 2024

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}).

from phppresentation.

Brenneisen avatar Brenneisen commented on September 25, 2024

@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?

from phppresentation.

Progi1984 avatar Progi1984 commented on September 25, 2024

Which version of PhpPresentation do you use ?

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

from phppresentation.

jesseg-traqline avatar jesseg-traqline commented on September 25, 2024

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.

from phppresentation.

WFarmerEthisphere avatar WFarmerEthisphere commented on September 25, 2024

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

from phppresentation.

Brenneisen avatar Brenneisen commented on September 25, 2024

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

from phppresentation.

ErikBernskiold avatar ErikBernskiold commented on September 25, 2024

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. :(

from phppresentation.

rappasoft avatar rappasoft commented on September 25, 2024

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.

from phppresentation.

ErikBernskiold avatar ErikBernskiold commented on September 25, 2024

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

from phppresentation.

crs-snap avatar crs-snap commented on September 25, 2024

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.

from phppresentation.

travhow99 avatar travhow99 commented on September 25, 2024

+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.

from phppresentation.

WFarmerEthisphere avatar WFarmerEthisphere commented on September 25, 2024

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.

from phppresentation.

ErikBernskiold avatar ErikBernskiold commented on September 25, 2024

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...

from phppresentation.

ErikBernskiold avatar ErikBernskiold commented on September 25, 2024

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

from phppresentation.

WFarmerEthisphere avatar WFarmerEthisphere commented on September 25, 2024

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

from phppresentation.

travhow99 avatar travhow99 commented on September 25, 2024

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

from phppresentation.

WFarmerEthisphere avatar WFarmerEthisphere commented on September 25, 2024

PR created to fix this here:
#761

from phppresentation.

rasikkunwar avatar rasikkunwar commented on September 25, 2024

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.

from phppresentation.

ioguimaraes avatar ioguimaraes commented on September 25, 2024

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

from phppresentation.

mohamadt94 avatar mohamadt94 commented on September 25, 2024

@Scheissy Wonderfull , works for me and solve my problem

from phppresentation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.