Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在HTML中打印变量时添加换行符_Javascript_Google Apps Script - Fatal编程技术网

Javascript 如何在HTML中打印变量时添加换行符

Javascript 如何在HTML中打印变量时添加换行符,javascript,google-apps-script,Javascript,Google Apps Script,我正在尝试在每个段落后添加换行符,如下面的Google sheet屏幕截图所示 基本上,我已经将该单元格存储为变量,并将其添加到HTML文件中。 但是,当我尝试发送邮件时,它会粘贴标记,而不是添加换行符 附加HTML代码的截图以及 请帮忙,谢谢 HTML和谷歌应用脚本代码附在下面- 函数代码(){ const ss=SpreadsheetApp.getActiveSpreadsheet(); const ws=ss.getSheetByName(“邮件详细信息”); var heading

我正在尝试在每个段落后添加换行符,如下面的Google sheet屏幕截图所示

基本上,我已经将该单元格存储为变量,并将其添加到HTML文件中。 但是,当我尝试发送邮件时,它会粘贴

标记,而不是添加换行符

附加HTML代码的截图以及

请帮忙,谢谢

HTML和谷歌应用脚本代码附在下面-

函数代码(){
const ss=SpreadsheetApp.getActiveSpreadsheet();
const ws=ss.getSheetByName(“邮件详细信息”);
var heading=ws.getRange(“B2”).getValue();
变量子目=ws.getRange(“C2”).getValue();
var body=ws.getRange(“J2”).getValue();
var footer=ws.getRange(“K2”).getValue();
var impfield1=ws.getRange(“D2”).getValue();
var impfield2=ws.getRange(“E2”).getValue();
var impfield3=ws.getRange(“F2”).getValue();
var fieldvalue1=ws.getRange(“G2”).getValue();
var fieldvalue2=ws.getRange(“H2”).getValue();
var fieldvalue3=ws.getRange(“I2”).getValue();
var file1=DriveApp.getFilesByName('SGB 2021-22.pdf')。next()
Logger.log(文件1)
const htmlTemplate=HtmlService.createTemplateFromFile(“SGB I.html”);
htmlTemplate.heading=标题;
htmlTemplate.subheading=副标题;
htmlTemplate.body=body;
htmlTemplate.footer=页脚;
htmlTemplate.impfield1=impfield1;
htmlTemplate.impfield2=impfield2;
htmlTemplate.impfield3=impfield3;
htmlTemplate.fieldvalue1=fieldvalue1;
htmlTemplate.fieldvalue2=fieldvalue2;
htmlTemplate.fieldvalue3=fieldvalue3;
const htmlforemail=htmlTemplate.evaluate().getContent();
GmailApp.sendmail(“mayank。agarwal@aumcap.com",
“SGB 2021-22系列第一期今日发行!”,
“SGB 2021-22系列第一期今日发行!”,
{附件:文件1,
htmlBody:htmlforemail},
)
}

产品说明
#展望a{
填充:0;
}
.es按钮{
mso风格优先级:100!重要;
文字装饰:无!重要;
}
a[x-apple-data-Detector]{
颜色:继承!重要;
文字装饰:无!重要;
字体大小:继承!重要;
字体家族:继承!重要;
字体大小:继承!重要;
行高:继承!重要;
}
.es隐藏的办公桌{
显示:无;
浮动:左;
溢出:隐藏;
宽度:0;
最大高度:0;
线高:0;
mso隐藏:全部;
}
[数据ogsb].es按钮{
边框宽度:0!重要;
填充:10px 20px 10px 20px!重要;
}
@仅媒体屏幕和(最大宽度:600px){p,ul-li,ol-li,a{行高:150%!重要}h1{字体大小:30px!重要;文本对齐:中心;行高:120%}h2{字体大小:26px!重要;文本对齐:中心;行高:120%}h3{字体大小:20px!重要;文本对齐:中心;行高:120%}.es页眉正文h1 a、.es内容正文h1 a、.es页脚正文h1 a{字体大小:30px!重要}.es页眉正文h2 a、.es内容正文h2 a、.es页脚正文h2 a{字体大小:26px!重要}.es页眉正文h3 a、.es内容正文h3 a、.es页脚正文h3 a{字体大小:20px!重要}.es菜单td a{字体大小:16px!重要}.es页眉正文p、.es页眉正文ul li、.es页眉正文ol li、.es页眉正文a{font size:16px!important}.es内容正文p、.es内容正文ul li、.es内容正文a{font size:16px!important}.es页脚正文p、.es页脚正文ul li、.es页脚正文ol li、.es页脚正文a{font size:16px!important}.es infoblock p、.es infoblock ul li、.es infoblock ol li、.es infoblock a{font size:12px!important}*[class=“gmail fix”]{display:none!important}.es-m-txt-c、.es-m-txt-ch1、.es-m-txt-ch1、.es-m-txt-ch2、.es-m-txt-ch3{text align:center!important}.es-m-txt-r、.es-m-txt-l、.es-m-txt-l h1、.es-m-txt-l h2、.es-m-txt-l h3{文本对齐:左!重要}.es-m-txt-r img、.es-m-txt-l img、.es-m-txt-l img{显示:内联!重要}.es按钮边框{显示:块!重要}a.es按钮,按钮{字体大小:20px!重要;显示:块!重要;边框宽度:10px 0px 0px!重要}.es自适应表、.es左、.es右{宽度:100%!重要}.es内容表、.es页眉表、.es内容表、.es页脚、.es页眉{宽度:100%!重要;最大宽度:600px!重要}.es自适应td{显示:块!重要;宽度:100%!重要}.es自适应图像{宽度:100%!重要;高度:自动!重要}.es-m-p0{padding:0px!important}.es-m-p0r{padding right:0px!important}.es-m-p0l{padding left:0px!important}.es-m-p0t{padding top:0px!important}.es-m-p0b{padding bottom:0!important}.es-m-p20b{padding bottom:20px!important}.es移动隐藏,.es隐藏{显示:无!重要}tr.es-desk-hidden,td.es-desk-hidden,table.es-desk-hidden{宽度:自动!重要;溢出:可见!重要;浮点:无!重要;最大高度:继承!重要;行高度:继承!重要}tr.es-desk-hidden{显示:表格行!重要}table.es-desk-hidden{显示:表格!重要}td.es-desk-desk-menu-hidden{显示:表格单元格!重要}.es菜单td{width:1%!important}table.es-table-not-adapt、.esd块html表{width:auto!important}table.es-social{display:inline block!important}table.es-social td{display:inline block!important}