Method
- setBackgroundRGB
- setBackground
- setBorder
- setDataValidation
- setDataValidations
- setFontColor
- setFontColors
- setFontFamilies
- setFontFamily
- setFontLine
- setFontLines
- setFontSize
setBackgroundRGB(red, green, blue)
function BackgroundColor2() {var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var cell = sheet.getRange("B3");
cell.setBackgroundRGB(200, 115, 120);
}
setBackground(color)
function BackgroundColor1() {var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var cell = sheet.getRange("B2");
cell.setBackground("blue");
}
setBorder(top, left, bottom, right, vertical, horizontal)
- null
- true
- false
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var cell = sheet.getRange("C3");
cell.setBorder(true, null, true, null, false, false);
}
function Border2() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var cell = sheet.getRange("D7:E8");
cell.setBorder(null, null, null, null, true, true);
}
setDataValidation(rule)
in worksetDataValidations(rules)
in worksetFontColor(color)
For one cell, more cells (range) - setFontColorsfunction FontColorMy2() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var cell = sheet.getRange("A16");
cell.setFontColor("yellow");
}
setFontColors(colors)
For more cells (range), for one cell - setFontColorfunction FontColorMy2() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
// set for Colors
var colors = [
["red", "black", "blue"],
["#FF0000", "#000000", "#0000FF"] ];
var cell = sheet.getRange("B7:D8");
cell.setFontColors(colors);
}
setFontFamilies(fontFamilies)
in worksetFontFamily(fontFamily)
function myFontFamily() {var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var cell = sheet.getRange("B2");
cell.setFontFamily("Helvetica");
}
- Arial
- Helvetica
- Times New Roman
- Georgia
- Verdana
- ....
setFontLine(fontLine)
For one cell (range), for more cells - setFontLines- underline
- line-through
- none
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var cell = sheet.getRange("B2");
cell.setFontLine("line-through"); // Note in Czech: přeškrtnuté
}
setFontLines(fontLines)
For more cells (range), for one cell - setFontLine- underline
- line-through
- none
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var cell = sheet.getRange("A2:B3");
var linesMy = [
["underline", "none"],
["underline", "line-through"] //
];
cell.setFontLines(linesMy);
}
setFontSize(size)
function FontSizeMy1() {var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var cell = sheet.getRange("B2");
cell.setFontSize(20);
}
Žádné komentáře:
Okomentovat