ExcelScript.DocumentPropertyType enum
Hinweise
Beispiele
/**
* This script uses a custom property to set the value and formatting of a cell.
* If the value of "Routing Number" is not set or is not a number, the cell will be red.
*/
function main(workbook: ExcelScript.Workbook) {
// Get the first cell from Sheet1.
const cell = workbook.getWorksheet("Sheet1").getCell(0,0);
// Get the "Routing Number" property.
const properties = workbook.getProperties();
const routingNumber = properties.getCustomProperty("Routing Number");
// If the property is missing or is not a number, change the formatting to indicate a problem.
if (!routingNumber || routingNumber.getType() != ExcelScript.DocumentPropertyType.number) {
cell.getFormat().getFill().setColor("red");
}
// If the property exists, use it to set the value of A1.
if (routingNumber) {
cell.setValue(routingNumber.getValue());
}
}
Felder
boolean | |
date | |
float | |
number | |
string |
Zusammenarbeit auf GitHub
Die Quelle für diesen Inhalt finden Sie auf GitHub, wo Sie auch Issues und Pull Requests erstellen und überprüfen können. Weitere Informationen finden Sie in unserem Leitfaden für Mitwirkende.
Office Scripts