I am trying to select only part of a paragraph/text element, the code below works partially as it selects the entire paragraph:
function FindTextSelection(){
var range = DocumentApp.getActiveDocument().newRange();
var findtext = DocumentApp.getActiveDocument().getBody().editAsText().findText("some").getElement();
Logger.log(findtext);
range.addElement(findtext);
DocumentApp.getActiveDocument().setSelection(range.build());
}
The aim is to find a #placeholder# and user can just type straight over the highlighted/selected text.
Can anyone point me in the right direction?