在Google Apps脚本文档服务中清除内容 [英] Erase content in Google Apps Script Document Service

查看:80
本文介绍了在Google Apps脚本文档服务中清除内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Google Apps Script Document Service中刷新文档?我是否需要遍历所有类型的元素,例如段落,图像,表格,并将其作为孩子删除?是否有一种更简单的方法来删除文档正文中的所有内容?

How to flush a document in Google Apps Script Document Service? Do I need to loop through all the kind of elements e.g. paragraph, image, table and remove them as a child? Is there an easier way to delete everything in the body of a document?

谢谢!

Thank you!

推荐答案

根据文档 Document.setText 应该能够清除文档内容。我假设以下命令应该这样做。

According to the Documentation, the Document.setText should be able to clear the document content. I assume the following command should do it.

doc.setText('');

这篇关于在Google Apps脚本文档服务中清除内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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