public static function set_background_color_of_master_slide($dataDir = null) { # Instantiate Presentation class that represents the presentation file $pres = new Presentation(); # Set the background color of the Master Slide to Forest Green $backgroundType = new BackgroundType(); $fillType = new FillType(); $color = new Color(); $pres->getMasters()->get_Item(0)->getBackground()->setType($backgroundType->OwnBackground); $pres->getMasters()->get_Item(0)->getBackground()->getFillFormat()->setFillType($fillType->Solid); $pres->getMasters()->get_Item(0)->getBackground()->getFillFormat()->getSolidFillColor()->setColor($color->GREEN); # Saving the presentation $save_format = new SaveFormat(); $pres->save($dataDir . "MasterBG.pptx", $save_format->Pptx); print "Set background color of master slide, please check the output file." . PHP_EOL; }