I have created a bookmark in Google Docs. I know the bookmark Id.
function addBookmark() {
var doc = DocumentApp.getActiveDocument();
var cursor = doc.getCursor();
var bookmark = doc.addBookmark(cursor);
var bookmarkId = bookmark.getId();
Logger.log(bookmarkId);
}
- Can I create an image from Google Drive at the bookmark?
- After creating the image I want to update it regularly with a time-based trigger. Do I have to delete the image before or can I update it without deleting it?
var childIndex = body.getNumChildren() - 1;body.insertImage(childIndex, image);This childIndex changes when adding more paragraps. How can I find the exact childIndex for a specific paragraph? By searching a text string? How works it? - Roberto Bbody.getChild(0).asParagraph().clear(); body.getChild(0).asParagraph().appendInlineImage(image);- is this the usual way to update a picture? My problem: the picture is at absolute position child index 0. When another user adds a paragraph before this position, the next picture update would append the picture to this position and not to the original paragraph. How can I get a relative child index position, depends on the paragraph text? - Roberto Bbody.getChild(0).asParagraph().clear(); body.getChild(0).asParagraph().appendInlineImage(image);After this, I add several paragraphs before it. The picture is at child index X, not 0 now. Yet, I will update exactly this picture. The child index is unknown. How can I find out what child index the picture has now? - Roberto B