title: How to get a link to a part of document (header, paragraph, section...)
body: <p>I'm creating a document dynamically with some heading structure</p>
  
  <pre><code>doc = DocumentApp.create("My Document");
  doc.appendParagraph("Main").setHeading(DocumentApp.ParagraphHeading.HEADING1);
  var section = doc.appendParagraph("Section 1");
  section.setHeading(DocumentApp.ParagraphHeading.HEADING2);
  </code></pre>
  
  <p>I can open it online, insert <em>Table of contents</em> and can access directly to "Section 1" by url like:
  <em>https://docs.google.com/document/d/1aA...FQ/edit#heading=h.41bpnx2ug57j</em></p>
  
  <p>The question is: How I can get similar url/id  to the "Section 1" in the code at run time and use it later as a link?</p>
  
  <p>If I can't - is there any way to set something like anchor/bookmark and get it's url?</p>
  
  <p>Thanks!</p>