I'm using Apps Script to fill a google doc with many paragraphs. Each paragraph has its header. Because the text is filled by itself by the script, sometimes a certain paragraph's header starts in the page's last row. I'm trying to avoid that.
I want to spot whether the last row I append in the paragraph before is at the end of the page (or even maybe in the last quarter of it) and if it is, to make a page break and move the next header to a new page. Is there a way to do so?
Thank for the help.
