【发布时间】:2015-07-27 20:47:55
【问题描述】:
我一直在尝试编辑一个脚本,我必须将某些文本加粗。此脚本从 Google 表单电子表格中提取信息并返回如下所示的电子邮件:
教师参与: 在最初的观察中,老师会适当地参与(直接指导、建模、构建知识、指导/独立实践等)
技术整合: 没有技术使用或集成的证据
我希望标题“教师参与:”和“技术集成”加粗并加下划线。如何在我的代码中实现 HTML?
我的代码是:
function sendEmail() {
var sheet = SpreadsheetApp.getActiveSheet();
var row = sheet.getActiveRange().getRowIndex();
var userEmail = sheet.getRange(row,
getColIndexByName("Username")).getValue();
var body = "Below are the results of a recent Walkthrough: ";
body += "\n\nTeacher Engagement: \n" + sheet.getRange(row,
getColIndexByName("Teacher Engagement")).getValue();
body += "\n\nTechnology Integration: \n" + sheet.getRange(row,
getColIndexByName("Technology Integration")).getValue();
MailApp.sendEmail(userEmail, subject, body, {name:"Classroom Walkthrough"});
}
【问题讨论】:
-
查看官方文档,其中发送了一个示例 html 电子邮件。尝试将当前字符串转换为 html,因为它当前不是那种格式。例如,将“\n”替换为 html 段落或只是
以保持简单。先试一试,然后根据您的结果更新我们
标签: javascript html google-apps-script formatting