繁体   English   中英

Google 脚本 - 在 Google 文档上运行

[英]Google Script - Running on Google Docs

我想从一个谷歌文档部署一个谷歌脚本项目,其中谷歌文档中的文本显示到 index.html 文件的特定区域。 有什么办法吗? 我会非常好奇地学习。

<html>
<h1> Header </h1>
[Google Document Code Goes Here.]
</html>

这是一个简单的对话框,它在 html 对话框中显示从 google 文档到 textarea 标签的文本。

function displaytestintextarea() {
  const doc = DocumentApp.getActiveDocument();
  const body = doc.getBody();
  const text = body.getText();
  DocumentApp.getUi().showModelessDialog(HtmlService.createHtmlOutput(`<textarea row="25" cols="50">${text}</textarea>`),"Text in TextArea");
}

在这种情况下,不需要提供整个 html。

在此处输入图像描述

您可以将其调整为您想要的任何大小。

问题未解决?试试以下方法:

Google 脚本 - 在 Google 文档上运行

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2023 STACKOOM.COM