ExcelScript.DocumentPropertyType enum
注解
示例
/**
* 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());
}
}
字段
boolean | |
date | |
float | |
number | |
string |
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈