Using a google docs script to find a horizontal rule -


i trying write google docs script locates horizontal rule within google doc. start wrote simple script below determine if cursor placed on horizontal rule or not. cannot seem "gettype()" work, returns "paragraph" not "horizontal_rule"!

function search() {      var doc = documentapp.getactivedocument();     var body = doc.getbody();     var cursor = doc.getcursor(); // find location of cursor      var element = cursor.getelement();      logger.log(element.gettype());      // use gettype() determine element's type.     if (element.gettype() == documentapp.elementtype.horizontal_rule) {          body.appendparagraph('the cursor element line.');     }      else {         body.appendparagraph('the cursor element not line.');      } } 


Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -