Google Apps脚本如何在网格中对齐

时间:2013-05-02 16:57:52

标签: javascript google-apps-script

如何对齐网格中单元格中心的按钮?

  var buttonGrid = app.createGrid(3,2).setId('buttonGrid');
  buttonGrid.setStyleAttribute(row, column, attribute, value);
  buttonGrid.setWidget(0,0,multiButton);
  buttonGrid.setWidget(1,0,submitB);

2 个答案:

答案 0 :(得分:0)

这有效:

  var buttonGrid = app.createGrid(3,2).setId('buttonGrid');
  buttonGrid.setStyleAttribute("text-align", "center");
  buttonGrid.setWidget(0,0,multiButton);
  buttonGrid.setWidget(1,0,submitB);

答案 1 :(得分:-1)

如果您只想将Button放在一列或一行中,您必须使用该对象的这些属性:

For Row:

grid.setRowStyleAttribute(row,"text-align", "center")

对于专栏:

grid.setColumnStyleAttribute(column,"text-align", "center")