Google Spreadsheet的边框按钮下的工具栏中还有一个用于更改颜色和更改边框样式的按钮。
如何在Google Apps脚本中访问这些内容?
为文档描述的setBorderColor
函数似乎不适用于电子表格。
最佳答案
报告的问题已修复,as of 12 Jan 2016。 Range现在具有以下方法:
文档中提供了示例;这是设置虚线红色边框*的方法:
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var cell = sheet.getRange("B2");
// Sets borders on the top and bottom, but leaves the left and right unchanged
// Also sets the color to "red", and the border to "DASHED".
cell.setBorder(true, null, true, null, false, false, "red", SpreadsheetApp.BorderStyle.DASHED);
*根据评论已更正:文档错误,应为SpreadsheetApp.BorderStyle.DASHED / DOTTED / SOLID,而不是Range。 –戈托弗里茨
关于colors - 以编程方式在电子表格中设置边框颜色和样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12900359/