Skip to content

Commit

Permalink
Merge pull request #776 from Progi1984/pr697
Browse files Browse the repository at this point in the history
PowerPoint2007 Writer : Fixed broken video file relationship
  • Loading branch information
Progi1984 committed Dec 6, 2023
2 parents 1aa28c4 + 27ed8b9 commit fa6fc54
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/changes/1.1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- PowerPoint2007 Writer : Outline : Fixed the base unit - [@Pakku](https://github.com/Pakku) in [#772](https://github.com/PHPOffice/PHPPresentation/pull/772)
- PowerPoint2007 Writer : Fixed column indices for embedded spreadsheets - [@michael-roth](https://github.com/michael-roth) in [#773](https://github.com/PHPOffice/PHPPresentation/pull/773)
- PowerPoint2007 Reader : Load images from file only if valid - [@aelliott1485](https://github.com/aelliott1485) in [#775](https://github.com/PHPOffice/PHPPresentation/pull/775)
- PowerPoint2007 Writer : Fixed broken video file relationship - [@potofcoffee](https://github.com/potofcoffee) in [#776](https://github.com/PHPOffice/PHPPresentation/pull/776)

## BC Breaks
- `PhpOffice\PhpPresentation\Style\Outline` : the width is now based on pixels (before in points)
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ protected function writeShapePic(XMLWriter $objWriter, AbstractGraphic $shape, i
$objWriter->writeAttribute('uri', '{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}');
// p:nvPr > p:extLst > p:ext > p14:media
$objWriter->startElement('p14:media');
$objWriter->writeAttribute('r:embed', ((int) $shape->relationId + 1));
$objWriter->writeAttribute('r:embed', 'rId' . ((int) substr($shape->relationId, strlen('rId')) + 1));
$objWriter->writeAttribute('xmlns:p14', 'http://schemas.microsoft.com/office/powerpoint/2010/main');
// p:nvPr > p:extLst > p:ext > ##p14:media
$objWriter->endElement();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,14 @@ public function testMedia(): void

$element = '/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/a:videoFile';
$this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element);
$this->assertZipXmlAttributeEquals('ppt/slides/slide1.xml', $element, 'r:link', 'rId2');
$element = '/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/p:extLst/p:ext';
$this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element);
$this->assertZipXmlAttributeEquals('ppt/slides/slide1.xml', $element, 'uri', '{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}');
$element = '/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/p:extLst/p:ext/p14:media';
$this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element);
$this->assertZipXmlAttributeEquals('ppt/slides/slide1.xml', $element, 'r:embed', 'rId3');
$this->assertZipXmlAttributeEquals('ppt/slides/slide1.xml', $element, 'xmlns:p14', 'http://schemas.microsoft.com/office/powerpoint/2010/main');

$this->assertIsSchemaECMA376Valid();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ private function getXmlNodeList(string $file, string $xpath): DOMNodeList

if (null === $this->xmlXPath) {
$this->xmlXPath = new DOMXPath($this->xmlDom);
$this->xmlXPath->registerNamespace('p14', 'http://schemas.microsoft.com/office/powerpoint/2010/main');
}

return $this->xmlXPath->query($xpath);
Expand Down

0 comments on commit fa6fc54

Please sign in to comment.