Reputation: 121
I try to create a presentation to use it as a template. And I need to define objectIDs of layouts (so I can easily create slide and apply layout). The only way I can define it, is to create a new presentation which have custom layouts and master.
The point that when I add master and layout keys into request, google slides api ignore it. It apply simple-light theme to the presentation.
How can I fix it?
Here is example of the code (I tried to add elements to slide and layout, but result is the same)
body = {
"masters": [
{
"pageType": "MASTER",
"objectId": "Master",
"masterProperties": {
"displayName": "Master Name"
}
}
],
"layouts": [
{
"pageType": "LAYOUT",
"objectId": "Layout",
"layoutProperties": {
"displayName": "Layout Name",
"name": "Layout Name",
"masterObjectId": "Master"
}
}
],
"slides": [
{
"slideProperties": {
"masterObjectId": "Master",
"layoutObjectId": "Layout"
},
"objectId": "Slide"
}
],
"title": "2019-11-12 - Template",
"locale": "en-US"
}
presentation = service.presentations().create(body = body).execute()
Upvotes: 1
Views: 1079
Reputation: 19309
As you can see in the official documentation, the method presentations.create
only creates a blank presentation. Only title
and, if you provide it, presentationId
will be taken into account. "Other fields in the request, including any provided content, are ignored". It is basically the same behaviour you get with Docs API.
So in order to add content, styles, properties, etc. to the presentation, you have to use batchUpdate.
I hope this is of any help to you.
Upvotes: 1