微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在Google脚本中使用rtl

如何解决在Google脚本中使用rtl

我正在使用Google表格发送带有Google脚本(Gmailapp)的消息。由于电子邮件是用波斯语撰写的,因此应从右到左显示;但是,这不是我所期望的。你有什么想法可以让它成为rtl吗?

function sendEmails2() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var startRow = 2; // First row of data to process
  var numRows = 2; // Number of rows to process
  // Fetch the range of cells A2:B3
  var datarange = sheet.getRange(startRow,1,numRows,3);
  // Fetch values for each row in the Range.
  var data = datarange.getValues();
  for (var i = 0; i < data.length; ++i) {
    var row = data[i];
    var emailAddress = row[1]; // First column
    var message = 'سلام '+row[0]+' عزیز،'+" \n"+row[2];
    var html= '<body>' +  '<h1 dir="rtl"> message </h1>' + '</body>'
    var alias=GmailApp.getAliases()
    var emailSent = row[4]; // Third column
    if (emailSent !== EMAIL_SENT) { // Prevents sending duplicates
      var subject = 'نظرسنجی';
      GmailApp.sendEmail(emailAddress,subject,message,{from: alias[0],htmlbody: html});
      sheet.getRange(startRow + i,4).setValue(EMAIL_SENT);
      // Make sure the cell is updated right away in case the script is interrupted
      SpreadsheetApp.flush();
    }
  }
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。