I want to set the textbox autofix as shrink to shape,
I dont understand how to set the autofit for existing as SHRINK text on overflow
Slides.Presentations.Pages[0].get(presentationId, pageObjectId).pageElements[3].shape.shapeProperties.autofit
I want to set the textbox autofix as shrink to shape,
I dont understand how to set the autofit for existing as SHRINK text on overflow
Slides.Presentations.Pages[0].get(presentationId, pageObjectId).pageElements[3].shape.shapeProperties.autofit
You are trying to set the properties of a shape by using a GET request.
If you check the documentation page of the request:
GET https://slides.googleapis.com/v1/presentations/{presentationId}/pages/{pageObjectId}
Gets the latest version of the specified page in the presentation.
Moreover, the fields you are using are also wrong. Pages is part of the request and you cannot pass any parameters to it and pageObjectId is in fact the id of the page, not the id of the object you are trying to modify.
In order to set the update the shape properties of an object, you will have to make the following request:
POST https://slides.googleapis.com/v1/presentations/{presentationId}:batchUpdate
And use the following body:
{
"requests": [
{
"updateShapeProperties": {
"objectId": "OBJECT_ID",
"shapeProperties": {
"autofit": {
"autofitType": "AUTOFIT_TYPE"
}
},
"fields": "autofit.autofitType"
}
}
]
}
However, it is important to note the following as it might be the reason you are receiving the Autofit types other than NONE are not supported error:
The field is automatically set to
NONEif a request is made that might affect text fitting within its bounding text box. In this case thefontScaleis applied to thefontSizeand thelineSpacingReductionis applied to thelineSpacing. Both properties are also reset to default values.
This concern has already been raised on Google's Issue Tracker here and you can see that this indeed the intended behavior in this situation. What you can do instead is to file a feature request by using the form here and provide all the necessary details.