在insertText()中将分页符插入Google文档 [英] Insert page break into google document in insertText()

查看:77
本文介绍了在insertText()中将分页符插入Google文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将文档与google apps脚本合并,并且我想保证每个新的页面"都将出现在实际的新页面上.

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.

我认识到我可以使用某种for循环和appendParagraph(text).appendPageBreak(),但是这可能是100-200页的合并,而且看起来非常缓慢且效率低下.

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.

我想做的就是只拥有一个.editAsText().setText(text),并且只需用一个巨大的字符串调用一次就可以了.但是,分页符似乎很困难,我不想动态地计算所需的新行/等

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?

推荐答案

维基百科所示,实际上,有一个特殊的转义符(la \n)用于分页符.

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

它是\f,效果很好.添加后,将下一行显示在新页面上.

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

这篇关于在insertText()中将分页符插入Google文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆