0
votes

I am searching for a way to cover the ugly black and white bullets in Google slides with colored shapes that match the presentation style. Those are tiny images stored on the Drive.

The classic way (through UI) of modifying the bullets (in the "Format" > "bullets" section) only offer the possibility to choose a symbol, but not its color or other style parameters.

I thought I could use a Google App script to load the image in the slide from my drive, and then place it at the bullet location. But I can't figure out how to get the bullet location. How can I get the bullet location?

Does someone know a better way to replace the bullets by a custom image in Google slides ?

1

1 Answers

0
votes

In order to get the bullet position, the closest thing that can help you achieve this, depending on how the objects are organized in your slides, is to retrieve the text box it belongs to.

var items = Slides.Presentations.Pages.get(PRES_ID, PAGE_OBJECT_ID)

This will end up returning all the items from the page with the id mentioned. Afterwards you will have to loop through these in order to retrieve the text box which contains the bullets and get its start position which will be stored in an object of type AffineTransform. However, please bear in mind that this will return the position of the text box.

When inserting an image using the Slides API, the createImageRequest is being used.

Taking this into account, this is how the structure of the createImageRequest looks like:

{
   "objectId": string,
   "elementProperties": {
      {
         "pageObjectId": string,
         "size": {
            object(Size)
         },
         "transform": {
            object(AffineTransform)
         }
      }
   },
   "url": string
}

If you want to manipulate the position of the image, you will have to make use of the AffineTransform object to match the one obtained from the previous step.

Reference