0
votes

How can I get which pages does a Google Docs Paragraph reside on?

I would like to write a that would compile multiple small text files (hundreds of song lyrics) into one long Google text document. I would like to make sure that no song lyrics get cut in half (only if it alone would fill more than a page) as that would make things inconvenient. I would like to do roughly the following:

  • Append another song lyric
  • Check if it overflows to the next page
  • If it does, remove the paragraph, append a page break, then re-append the song lyric.
  • Repeat

But no matter how deep I read the documentation I cannot find a function which would help me in the second step.

1
It would be helpful to see what you've already tried. - Brian
I'm new to Google Apps scripts and I haven't yet written a single line of it. I was just reading the documentation to see if it is fit for this purpose - if it doesn't support programmatically determining if a paragraph overflows to the next page (which I really doubt), I will end up using something else. I am positive I can do all the other necessary steps, but I can't find a word about pagination in the documentation and thus I have no idea how to do the second step. I'll throw together a tiny example though in a few hours. - matega

1 Answers

1
votes

I've managed this countin the chars and calculated how many you could fit, in my case 228, it was 2 tables with photos for every page. Of course you have to define a safe range because some chars takes more space than others, or use a monospaced font, account for paragraphs, line breaks, etc.

But no, never found a native method to check for this.