SetFontName
将指定的字体系列设置为当前单元格范围的字体名称。
语法
expression.SetFontName(sName);
expression - 表示 ApiRange 类的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 默认值 | 描述 |
|---|---|---|---|---|
| sName | 必需 | string | 用于当前单元格范围的字体系列名称。 |
返回值
boolean
示例
更改电子表格中单元格范围使用的字体系列。
// How do I switch the typeface for a group of cells in a spreadsheet?
// Apply a named font to all text within a range of cells in a spreadsheet.
let worksheet = Api.GetActiveSheet();
worksheet.GetRange("A2").SetValue("2");
let range = worksheet.GetRange("A1:D5");
range.SetFontName("Arial");