11
11
use PhpOffice \PhpPresentation \Slide ;
12
12
use PhpOffice \PhpPresentation \Slide \SlideMaster ;
13
13
use PhpOffice \PhpPresentation \Style \SchemeColor ;
14
+ use PhpOffice \PhpPresentation \Slide \Background \Image ;
14
15
15
16
class PptSlideMasters extends AbstractSlide
16
17
{
@@ -24,6 +25,13 @@ public function render()
24
25
$ this ->oZip ->addFromString ('ppt/slideMasters/_rels/slideMaster ' . $ oMasterSlide ->getRelsIndex () . '.xml.rels ' , $ this ->writeSlideMasterRelationships ($ oMasterSlide ));
25
26
// Add the information from the masterSlide to the ZIP file
26
27
$ this ->oZip ->addFromString ('ppt/slideMasters/slideMaster ' . $ oMasterSlide ->getRelsIndex () . '.xml ' , $ this ->writeSlideMaster ($ oMasterSlide ));
28
+
29
+ // Add background image slide
30
+ $ oBkgImage = $ oMasterSlide ->getBackground ();
31
+ if ($ oBkgImage instanceof Image) {
32
+ $ this ->oZip ->addFromString ('ppt/media/ ' . $ oBkgImage ->getIndexedFilename ($ oMasterSlide ->getRelsIndex ()), file_get_contents ($ oBkgImage ->getPath ()));
33
+ }
34
+
27
35
}
28
36
29
37
return $ this ->oZip ;
@@ -55,7 +63,16 @@ public function writeSlideMasterRelationships(SlideMaster $oMasterSlide)
55
63
$ slideLayout ->relationId = 'rId ' . $ relId ;
56
64
}
57
65
// Write drawing relationships?
66
+
58
67
$ this ->writeDrawingRelations ($ oMasterSlide , $ objWriter , $ relId );
68
+
69
+ // Write background relationships?
70
+ $ oBackground = $ oMasterSlide ->getBackground ();
71
+ if ($ oBackground instanceof Image) {
72
+ $ this ->writeRelationship ($ objWriter , ++$ relId , 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image ' , '../media/ ' . $ oBackground ->getIndexedFilename ($ oMasterSlide ->getRelsIndex ()));
73
+ $ oBackground ->relationId = 'rId ' . $ relId ;
74
+ }
75
+
59
76
// TODO: Write hyperlink relationships?
60
77
// TODO: Write comment relationships
61
78
// Relationship theme/theme1.xml
0 commit comments