我正在使用一个脚本来替换Google模板中的字符串。如果我使用\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.有办法这么做吗?
发布于 2013-11-08 09:33:14
不能从段落的内容中创建段落,可以在脚本本身中切片字符串,从而在脚本中使用appendParagraph方法。
发布于 2013-11-08 09:39:05
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>。
https://stackoverflow.com/questions/19850320
复制相似问题