我正在尝试将Google文档内容发送到电子邮件,但无法以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"});
}