我正在尝试发送谷歌文档的内容到电子邮件,但无法获得它的html格式,请帮助。
邮件正在处理中,但不包含字体和颜色。
代码如下:
function getGoogleDocumentAsHTML(){
var id = DocumentApp.getActiveDocument().getId() ;
var forDriveScope = DriveApp.getStorageUsed(); //needed to get Drive Scope requested
var url = "https://docs.google.com/feeds/download/documents/export/Export?id="+id+"&exportFormat=html";
var param = {
method : "get",
headers : {"Authorization": "Bearer " + ScriptApp.getOAuthToken()},
muteHttpExceptions:true,
};
var html = UrlFetchApp.fetch(url,param).getContentText();
var subject = "November 19 2015";
MailApp.sendEmail("xxxxxx@gmail.com", subject,"", {htmlBody:html, name:"Work Program", cc:"", replyTo:"xxxxx@gmail.com"});
}发布于 2016-01-22 20:16:58
加上这个....
body { -webkit-print-color-adjust: exact;}
here解释了使用此解决方案的原因
https://stackoverflow.com/questions/33796450
复制相似问题