2

我正在使用一个脚本来替换 Google Docs 模板中的字符串。如果我使用该\n命令,我可以在模板中获得一个新行。

sample = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. \n Lorem Ipsum is simply dummy text of the printing and typesetting industry."

我得到这样的东西:

      Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum is simply dummy text of the printing and typesetting industry.

但我想添加的不是新字符串,而是新段落(根据模板设置):

      Lorem Ipsum is simply dummy text of the printing and typesetting industry.
      Lorem Ipsum is simply dummy text of the printing and typesetting industry.

有什么办法可以做到吗?

4

2 回答 2

1

您不能从段落内容中创建段落,请通过在脚本本身中切片字符串来使用脚本中的appendParagraph方法。

于 2013-11-08T09:33:14.907 回答
0
    sample = "<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
 </p><p> Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>"

如果您有想要段落的字符串部分,这将起作用。如果没有,您可以在字符串中/n替换为</p><p>

于 2013-11-08T09:39:05.317 回答