Skip to content

Commit d18c033

Browse files
committed
PowerPoint2007 Writer : Keynote incompatibility (GH-46)
1 parent c0ef044 commit d18c033

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
### Bugfix
1111
- PowerPoint2007 Writer : Powerpoint Repair Error in Office 2010 - @Progi1984 GH-39
1212
- PowerPoint2007 Writer : BUG: Repair Error / Wrong anchor if you don't set vertical alignment different to VERTICAL_BASE - @fregge GH-42
13-
- PowerPoint2007 Writer : Keynote incompatibility - @catrane CP#237322
13+
- PowerPoint2007 Writer : Keynote incompatibility - @catrane CP#237322 / @Progi1984 GH-46
1414

1515
### Miscellaneous
1616
- QA : Move AbstractType for Chart - @Progi1984

src/PhpPowerpoint/Writer/PowerPoint2007.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ public function save($pFilename)
216216
// Add PPT properties and styles to ZIP file - Required for Apple Keynote compatibility.
217217
$objZip->addFromString('ppt/presProps.xml', $wPptProps->writePresProps());
218218
$objZip->addFromString('ppt/tableStyles.xml', $wPptProps->writeTableStyles());
219+
$objZip->addFromString('ppt/viewProps.xml', $wPptProps->writeViewProps());
219220

220221
// Add relationships to ZIP file
221222
$objZip->addFromString('_rels/.rels', $wPartRels->writeRelationships());

src/PhpPowerpoint/Writer/PowerPoint2007/PptProps.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
class PptProps extends AbstractPart
2323
{
24-
/**
24+
/**
2525
* Write ppt/presProps.xml to XML format
2626
*
2727
* @param PhpPowerpoint $pPHPPowerPoint
@@ -98,6 +98,33 @@ public function writeTableStyles()
9898
$objWriter->writeAttribute('def', '{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}');
9999
$objWriter->endElement();
100100

101+
return $objWriter->getData();
102+
}
103+
/**
104+
* Write ppt/viewProps.xml to XML format
105+
*
106+
* @param PhpPowerpoint $pPHPPowerPoint
107+
* @return string XML Output
108+
* @throws \Exception
109+
*/
110+
public function writeViewProps()
111+
{
112+
// Create XML writer
113+
$objWriter = $this->getXMLWriter();
114+
115+
// XML header
116+
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
117+
118+
// p:viewPr
119+
$objWriter->startElement('p:viewPr');
120+
$objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
121+
$objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
122+
$objWriter->writeAttribute('xmlns:p', 'http://schemas.openxmlformats.org/presentationml/2006/main');
123+
$objWriter->writeAttribute('showComments', '0');
124+
125+
// > p:viewPr
126+
$objWriter->endElement();
127+
101128
return $objWriter->getData();
102129
}
103130
}

0 commit comments

Comments
 (0)