How To Determine The Named Range From Position In Google Docs Through Google Apps Script
I am looking at a way to determine the named range in Google docs through Google Apps Script for the current cursor position. Is there anyway to do that? Context: I am marking a ra
Solution 1:
var cursor = DocumentApp.getActiveDocument().getCursor();
cursor is a "Position".
A "Position" can tell you several things, for example the element which holds the position. Be careful: The thinking of a position is quite opposite: A position cannot contain other elements. A position is contained within an element.
So i think you could search your named ranges for this element:
cursor.getElement()
You have to iterate through your ranges, i think and if there is a match ... bingo.
Let me know if this helps.
Post a Comment for "How To Determine The Named Range From Position In Google Docs Through Google Apps Script"