Insert page break into google document in insertText()

落花浮王杯 提交于 2020-01-06 02:30:52

问题


I'm making a document merge with google apps script and I want to guarantee that each new 'page' will be on an actual new page.

I recognize that I could use some sort of for loop and appendParagraph(text).appendPageBreak() but, this could be a 100-200 page merge and it seemed very slow and inefficient.

What I'd like to do is just have one .editAsText().setText(text) and be able to just call it once with a huge string and be done. But, the page break seemed difficult and I didn't want to have to dynamically calculate the needed new lines/etc

Is there a way to insert page breaks into plain text?


回答1:


As Wikipedia shows, there's actually a special escape character (á la \n) for page break.

It's \f and it works perfectly. Adding that puts the next line on a new page.



来源:https://stackoverflow.com/questions/29042999/insert-page-break-into-google-document-in-inserttext

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!