I'm using the following code for replacing a text on google docs:
var sampleDoc = DocumentApp.openById(copyId),
var docBody = sampleDoc.getBody();
docBody.replaceText('%sample_placeholder%','some text');
All is working fine but this time I'll be needing to put a text on top of an image, so basically I put the %sample_placeholder%
on a Text Box
during insert of image on Insert > Drawing
. The code above no longer works.
Any ideas on how to search and replace text on text boxes?
Thanks in advance!
Any workaround available for this?
Additional info: The text to be put on the image is coming from a user input. The image is actually a rectangular label tag box (use for labeling things) with space on it's middle where the text can be put into.
The idea is that the Google Document with image and text on image (let's call the text a text placeholder) will serve as a template. This Google Document template is being recopied by Google Apps Script and should replace the text placeholder with the input coming from user and saved as separate file.
It looks something like this (I was given an image created by a designer), and text will be put on the middle of the image.