Search code examples
google-apps-scriptgoogle-slides-api

Google Apps Script Slides add shadow to a shape


I am trying to add a shadow to a shape in slides via the Google Apps Script Api for slides. I followed https://developers.google.com/slides/reference/rest/v1/presentations.pages/other#Page.Shadow

This is my updateShapeRequest object

{
      "updateShapeProperties":{
        "objectId":pageElementId,
        "shapeProperties":{

          "shadow":{
            "alignment": "RECTANGLE_POSITION_UNSPECIFIED",
            "alpha":0.5,
            "blurRadius":{"unit":"EMU"},
            "color":{
              "rgbColor": {
                  "red":0,
                  "green":0,
                  "blue":0
               },
            },
              "propertyState":"RENDERED",
              "rotateWithShape": false,
              "transform": {
                "scaleX": 1.5,
                "scaleY": 1.5,
                "unit": "PT"
              }
          }
        },
        "fields":"shadow"
      }
    }

But it doesnt work. Any help is greatly appreciated.


Solution

  • The official document says as follows.

    shadow: The shadow properties of the shape. If unset, the shadow is inherited from a parent placeholder if it exists. If the shape has no parent, then the default shadow matches the defaults for new shapes created in the Slides editor. This property is read-only. Ref

    From this, in the current stage, shadow of ShapeProperties is the read-only. By this, unfortunately, the shadow cannot be added using UpdateShapePropertiesRequest with the batchUpdate method of Slides API. And also, in this case, in the current stage, Slides service cannot also achieve this.

    So, how about requesting this as the future request to the issue tracker?

    References: