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

#266 : PowerPoint2007 Writer : Fix for Need repair #303

Merged
merged 2 commits into from
Jan 9, 2017

Conversation

Progi1984
Copy link
Member

No description provided.

@informed-source
Copy link

I have tested 79c4cff briefly with my own sample file that produces a chart on a slide. This generates a .pptx file that opens successfully in PowerPoint for Mac 2011 14.5.2 and correctly displays a chart. Great. If I open the pptx file in Keynote, there are no warnings but there is no chart on the slide. However, if I save the .pptx file from PowerPoint and open it in Keynote, it appears as expected, with the chart, although there are currently some formatting differences.

Running the Sample 05 Chart, if I open the resulting .pptx I get the error "Powerpoint found a problem with content in the Sample_05_Chart.pptx" with the option to Repair. If Repair is selected it says "PowerPoint removed unreadable content..." The charts in the resulting PowerPoint appear correctly but there is a broken image in the top left of each slide saying the image cannot be displayed.

The same issue occurs with Sample_01_Simple. However, if I comment out lines 27-39 that Create shape with setPath('./resources/phppowerpoint_logo.gif') the pptx opens with no problem in both PowerPoint and Keynote and displays a slide with "Thank you for using PHPPresentation!"

With Sample_05_Chart the resulting pptx opens in Keynote with "An unknown error occurred". The presentation appears with ten slides, each with the PHPPowerpoint logo in the top left [Should that be 'PHP Presentation'?] with a drop shadow, but no charts. This suggests that there is not a problem finding the logo image.

If the repaired Sample_05_Chart is saved and then opened in Keynote it produces a warning that "Unsupported media were removed" and "An unknown error occurred". All 10 slides are blank.

I appreciate that support for Keynote is not the main objective, but this information may also help troubleshoot issues reported by PowerPoint.

@Progi1984
Copy link
Member Author

@informed-source: Thanks for the complete report.

Could you send me "the .pptx file saved from PowerPoint" which is good and the file in error ? I need it to analyze what is the difference.

Is the image well in the directory "samples / ressources" ?

If you are ok 👌 for helping, I will try to improve the support of Keynote. (sorry, I haven't got Keynote)

@informed-source
Copy link

Attached are files generated by Sample_05_Chart, as output, after repair in PowerPoint on the Mac, and for comparison after opening in Keynote and saving as pdf and pptx.

Sample_05_Chart-as-output.pptx
Sample_05_Chart [repaired].pptx
Sample_05_Chart-opened-in-Keynote-and-exported.pdf
Sample_05_Chart-opened-in-Keynote-and-exported.pptx

Note that the file 'repaired' by PowerPoint has a broken image on every slide but includes the charts.
The originally generated file read by Keynote and 'repaired' by exporting as pptx has the image on every slide, but not the charts.

The source image is present as
/PhpOffice/samples/resources/phppowerpointlogo.gif
It appears to be present, multiple times, in the PowerPoint bundle file as
/ppt/media/phppowerpointlogo2[...4,6,8,10,12,14,16,18,20].gif
The gif files themselves appear to be identical.

See also issue:
samples crash and logo.gif #297

Copy link
Contributor

@jvanoostrom jvanoostrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi there,

I've reviewed the changes using my own written scripts. The "repair" error is gone in PPT2016. Furthermore, the "first" image on the slide now properly works (no "image cannot be displayed" error).

Thanks for the fix!

@Progi1984
Copy link
Member Author

@informed-source @jvanoostrom I pushed some code in the PR for fixing the 5th sample. Could you test again, please ?

@informed-source
Copy link

Many thanks indeed for this, especially on Christmas Day!

I downloaded Tree 146c06d
and used the src/PhpPresentation files
and the
samples folder

I edited /samples/Sample_Header.php file to point to the correct Autoloader location for this deployment
// require_once DIR . '/../vendor/autoload.php';
require_once DIR . '/../PhpPresentation/Autoloader.php';

// require_once DIR . '/../vendor/autoload.php';
require_once DIR . '/../Common/Autoloader.php';
\PhpOffice\Common\Autoloader::register();

My own script now runs fine and appears correct in PowerPoint, with charts appearing as expected.
The pptx file opens without error in Keynote with all the slides present as expected, but still without the charts.
The output also previews correctly in Safari on iOS and opens and displays correctly in PowerPoint but the charts do not appear in Keynote.
It appears to be an issue specifically with the charts, as most of the other sample files open without problems in Keynote.

Sample_05_Chart.php
This sample now runs as expected. The resulting file now opens in PowerPoint without error and shows both the charts and the PHPPowerPoint logo [should this really be PHP Presentation now?]
The pptx file opens in Keynote with the message "An unknown error occurred." There are ten slides with the logo image, but still no charts, which is consistent with the experience with my own script.

I understand that this project is intended to support PowerPoint, but Keynote is now very good at opening PowerPoint files and compatibility with the generated files appears to be very close.

For reference, these are the results of testing all the sample files:
Sample_01_Simple.php - works
Sample_02_Serialized.php - executes but does not appear to produce serialized output.
Sample_03_Image - works but pptx produces PowerPoint error: 'PowerPoint found an error it cannot correct.'; pptx opens in Keynote but slide does not appear to be correct.
Sample_04_Table - works; opens in Keynote and displays table and image correctly.
Sample_05_Chart_Line - works; opens in Keynote but does not display charts. Note that this also occurs if the originated pptx file is opened and resaved in PowerPoint.
Sample_06_Fill - works; opens in Keynote and displays correctly.
Sample_07_Border - works; opens in Keynote and displays correctly.
Sample_08_Group - works; opens in Keynote and displays correctly.
Sample_09_SlideNote - works; Keynote reports: 'can't be opened for some reason'. If the originated pptx file is opened and reserved in Powerpoint it opens correctly in Keynote, including Presenter Notes.
Sample_10_Transition - works; opens in Keynote and displays correctly.
Sample_11_Shape - works (although is more a demonstration of text in a shape); opens in Keynote and displays correctly.
Sample_12_Reader_ODPresentation - works
Sample_12_Reader_PowerPoint2007 - works
Sample_12_Reader_PowerPoint97 - works
Sample_13_MarkAsFinal - works; opens in Keynote and displays correctly.
Sample_14_Zoom - works; opens in Keynote and displays correctly, at normal zoom.
Sample_15_Background - works; opens in Keynote and displays correctly.
Sample_16_Thumbnail - works; opens in Keynote and displays correctly.
Sample_17_Comment - works; opens in Keynote and displays comments correctly.
Sample_18_Animation - works; opens in Keynote and displays animation correctly.
Sample_19_SlideMaster - works; opens in Keynote and uses master correctly.

@Progi1984
Copy link
Member Author

@informed-source No problem, I took advantage of the calm of the end of this Christmas day to make benefit PhpPresentation. Thank you for your tests :) Sorry, I don't have Mac and Keynote.

Could you shorten the code of the 5th sample to the first slide and try to open it in Keynote ?
Question : Do you have also the problem in Keynote Web (not an export of Mac World : iWork for iCloud) ?

We work on the 5th sample . And we see after that for two another samples.

@informed-source
Copy link

Thanks again for your work on this over the holiday period, which is much appreciated.

As requested, in Sample_05_Chart.php I have commented out the function calls for all of the slides apart from the first one, fnSlide_Area($objPHPPresentation). The output pptx file opens as expected in PowerPoint for Mac 2011 (14.5.2) and displays a single slide with an area chart. The pptx file results in the warning "An unknown error occurred" in Keynote and the single slide displays only the gif logo and no chart. When the pptx file is uploaded to the online iCloud Keynote service it imports but also displays only the gif logo and no chart. So the online service could be used for initial testing of Keynote compatibility.

If the originated pptx file is opened in PowerPoint but then saved from PowerPoint, it displays correctly in PowerPoint but is still missing the chart when opened in Keynote, either in the OSX application or in the iCloud web view. However, if the area chart is deleted in PowerPoint and recreated as a native PowerPoint/Excel chart and this is saved as a pptx file, it opens and displays as expected in Keynote and iCloud Keynote. This implies that such charts are generally compatible across PowerPoint and Keynote but there may be something about how they are written out by PhpPresentation. This may be an issue not only for Keynote but for general conformance with PowerPoint.

Incidentally, the develop branch of PhpExcel is deployed in this case.

@Progi1984
Copy link
Member Author

@informed-source Could you create a PPTX with a very simple chart with PowerPoint (which can be opened in Keynote) ?

I will try to generate the code for this file, and diff the content of the generated PPTX and your file.

@informed-source
Copy link

I have used the single slide version of Sample_05 as the base for this test and attempted to recreate something very similar manually, which opens and displays correctly in both PowerPoint and Keynote.

Generated from PhpPresentation
Sample_05_Chart_Single_Slide-as-generated.pptx
This opens in Keynote with "An unknown error occured' and does does not show the chart.

Opened in PowerPoint and resaved as pptx
Sample_05_Chart_Single_Slide-as-generated-and-resaved.pptx
This opens in Keynote with "An unknown error occured' and does does not show the chart.

Recreated in PowerPoint (deleted chart and added manually with similar properties)
Sample_05_Chart_Single_Slide-recreated-in-PowerPoint.pptx
This opens in Keynote and displays the chart correctly. The only apparent difference are the labels for the series, see PDF export from Keynote below.
Sample_05_Chart_Single_Slide-recreated-in-PowerPoint-opened-in-Keynote.pdf

This is the file recreated in PowerPoint, opened in Keynote and exported back to PowerPoint.
Sample_05_Chart_Single_Slide-recreated-in-PowerPoint-opened-in-Keynote-exported-to-PowerPoint.pptx
This opens and displays in both PowerPoint and Keynote. The only apparent difference is the positioning of the series labels.

@RETFU
Copy link

RETFU commented Dec 30, 2016

Like @jvanoostrom it fixed the same bug for us.

@Progi1984
Copy link
Member Author

@informed-source Could you test a thing ?

In the file PhpPresentation\Writer\PowerPoint2007\PptCharts.php, could you move the line

$this->getZip()->addFromString('ppt/charts/_rels/' . $shape->getIndexedFilename() . '.rels', $this->writeChartRelationships($shape));

before the line :

if ($shape->hasIncludedSpreadsheet()) {

@informed-source
Copy link

Unfortunately, that appears to break the output, resulting in empty slides.

@Progi1984
Copy link
Member Author

@informed-source Shit 💩 ! I don't know where the problem is !

@informed-source
Copy link

:-(
Is there anything else I can test?

@Progi1984
Copy link
Member Author

@informed-source I don't know where the problem can be... Without a Keynote, I can't make tiny tests for finding where the problem is. But I have no idea where Keynote has problems.

@informed-source
Copy link

You may be able to open a PowerPoint file with Keynote online. Search for Apple iWork iCloud. It currently works with Safari, Chrome or IE 10+.

@Progi1984
Copy link
Member Author

Progi1984 commented Jan 5, 2017

@informed-source https://www.icloud.com/

Account created ;)

@jamesggordon
Copy link
Contributor

@Progi1984 I am working on a Mac and have Keynote plus old (2008) and new (2016) versions of PowerPoint. Happy to help out with testing.

FWIW - I just tried generating a fairly complex file with the current version and it failed to open at all on Keynote and PP08. It repaired and mostly opened on PP16.

@jamesggordon
Copy link
Contributor

jamesggordon commented Jan 6, 2017

@Progi1984 Actually, ignore my comment about the current version - I may not have been using the correct branch. Will double check this over the weekend and re-do the test.

@Progi1984
Copy link
Member Author

@informed-source I have some hints to test... Now, with Keynote on iCloud, I can test if it's ok... :) before asking tests on Keynote on MacOs

@informed-source
Copy link

Thanks. Happy to test further on OSX when you have something.

@Progi1984
Copy link
Member Author

@informed-source Could you test the Sample 05 Chart with PHPExcel, please, with Keynote, please ?

@informed-source
Copy link

Thanks for your work on this.

I tested Sample 05 Chart with PHPExcel.
I added this to the sample file make it work in my configuration:
require_once dirname(DIR) . '/PHPExcel.php';

In PowerPoint this opens correctly and displays two slides, with a bar chart and a pie chart.
In Keynote it opens without error but does not display the bar chart, although the pie chart displays appropriately.

This is with and without moving this line in PhpPresentation\Writer\PowerPoint2007\PptCharts.php:
$this->getZip()->addFromString('ppt/charts/_rels/' . $shape->getIndexedFilename() . '.rels', $this->writeChartRelationships($shape));

@Progi1984
Copy link
Member Author

@informed-source Good news. I have the same render. I think I will create an issue and a MR for working on compatibility with Keynote. That will permit for another user to have PPTX with PowerPoint :) No problem with that ?

@informed-source
Copy link

Thanks. Your continued work on this is appreciated.

@Progi1984 Progi1984 merged commit 6339160 into PHPOffice:develop Jan 9, 2017
@Progi1984 Progi1984 deleted the issue266 branch January 9, 2017 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants