在创建请求中创建一个颜色填充的形状
Create A Color Filled Shape in the Create Request
如何使用 Google 幻灯片 API 创建红色矩形?以下代码无效:
var requests = [{
createShape: {
objectId: elementId,
shapeType: 'RECTANGLE',
shapeProperties: {
shapeBackgroundFill: {
solidFill: {
color: {
"themeColor": "Red"
}
}
}
},
elementProperties: {
pageObjectId: 'gc448bf14e8_0_0',
size: {
height: pt150,
width: pt150
},
transform: {
scaleX: 1,
scaleY: 1,
translateX: 150,
translateY: 100,
unit: 'PT'
}
}
}
},
GoogleJsonResponseException: API call to slides.presentations.batchUpdate failed with error: Invalid JSON payload received. Unknown name "shapeProperties" at 'requests[0].create_shape': Cannot find field.
此资源要更改形状,我想将其放入原始请求对象中。
Change background of google slides shape to red
正在查看此 Google 资源:https://developers.google.com/slides/reference/rest/v1/presentations.pages/shapes
目前 createshaperequest
的 API 没有 shapeProperties。只有 updateShapeProperties
有。
我提出了两个要求,
var requests2 = [{
updateShapeProperties: {
objectId: elementId,
fields: "shapeBackgroundFill.solidFill.color",
shapeProperties: {
shapeBackgroundFill: {
solidFill: {
color: {
rgbColor:
{
red: 0.6,
green: 0.0,
blue: 0.0
}
}
}
}
}
}
}];
https://developers.google.com/slides/reference/rest/v1/presentations/request#createshaperequest
如何使用 Google 幻灯片 API 创建红色矩形?以下代码无效:
var requests = [{
createShape: {
objectId: elementId,
shapeType: 'RECTANGLE',
shapeProperties: {
shapeBackgroundFill: {
solidFill: {
color: {
"themeColor": "Red"
}
}
}
},
elementProperties: {
pageObjectId: 'gc448bf14e8_0_0',
size: {
height: pt150,
width: pt150
},
transform: {
scaleX: 1,
scaleY: 1,
translateX: 150,
translateY: 100,
unit: 'PT'
}
}
}
},
GoogleJsonResponseException: API call to slides.presentations.batchUpdate failed with error: Invalid JSON payload received. Unknown name "shapeProperties" at 'requests[0].create_shape': Cannot find field.
此资源要更改形状,我想将其放入原始请求对象中。 Change background of google slides shape to red
正在查看此 Google 资源:https://developers.google.com/slides/reference/rest/v1/presentations.pages/shapes
目前 createshaperequest
的 API 没有 shapeProperties。只有 updateShapeProperties
有。
我提出了两个要求,
var requests2 = [{
updateShapeProperties: {
objectId: elementId,
fields: "shapeBackgroundFill.solidFill.color",
shapeProperties: {
shapeBackgroundFill: {
solidFill: {
color: {
rgbColor:
{
red: 0.6,
green: 0.0,
blue: 0.0
}
}
}
}
}
}
}];
https://developers.google.com/slides/reference/rest/v1/presentations/request#createshaperequest