Google Slides API - How way change theme via API

核能气质少年 提交于 2021-02-20 02:52:16

问题


(Sorry for my english)

I have a problem when using Google Slides API. How can I choose a theme when create new presentation with Google Slides API?

Thanks.


1. create a presentation

    function createPresentation($title) {
        $presentation = new Google_Service_Slides_Presentation(array(
            'title' => $title
        ));
        $presentation = $this->slidesService->presentations->create($presentation);
        $presentationLastId = $presentation->presentationId;

        return $presentationLastId;
    }

2. append a slide

    protected function createSlideRequest($presentationId, $slideId, $data = array())
    {
        $requests = array();
        $requests[] = new Google_Service_Slides_Request(array(
            'createSlide' => array (
                'objectId' => $slideId,
                'slideLayoutReference' => array ('predefinedLayout' => 'BLANK')
             ),
        ));

        $batchUpdateRequest = new Google_Service_Slides_BatchUpdatePresentationRequest(array(
            'requests' => $requests
        ));

        $response = $this->slidesService->presentations->batchUpdate($presentationId, $batchUpdateRequest);

        return $response;
    }
  • The result like image below after call two requests:

  • But i want create a presentation like:

来源:https://stackoverflow.com/questions/52870270/google-slides-api-how-way-change-theme-via-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!