制作表格的更好方法(htmlservice?)

时间:2015-05-21 04:50:53

标签: google-apps riot-games-api

我已经使用Google脚本API创建了我的第一个网络应用程序(它现在有点像一个网页)。

http://bit.do/WhoKilledWho

从这次经历中我想到了#哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇 urlFetchApp.fetch()

整理数据不是那么容易,但也不是太糟糕。很多循环等。

然而,创建我的"表"输出是可怕的。

  // Blue team Output
  output = "<table class='gradienttable' width = '60%'><tr><th>Blue Team</th>"
  for (p in players) {
    if (players[p].team != 100) {
      output = output + "<th width = '14%'>" + players[p].pname + "<br>(" + players[p].cname + ")</th>";}
  }

  for (p in players) {
    //output = output + "<tr>";
    i = 1;
    for (k in players){
      if (players[p].team == 100) {
        if (i==1) { output = output + "<tr><th  width = '14%'>" + players[p].pname + "<br>(" + players[p].cname + " " +players[p].kda +")</th>"; }
        if (players[k].team != players[p].team) {
          output = output + "<td>" + players[p].killed[k] + "</td>";}
        i++;
      }
    }
    output = output + "</tr>";
  }
  output = output + "</table>";
  return output;

是否有JSON.htmltablify(myobject)或类似的东西?

0 个答案:

没有答案