跳到主要内容

SetLocale

设置文档的区域设置。

语法

expression.SetLocale(LCID);

expression - 表示 Api 类的变量。

参数

名称必需/可选数据类型默认值描述
LCID必需number指定的区域设置。

返回值

boolean

示例

在电子表格中为文档应用特定的区域语言设置。

// How do I change the language and region used for dates, numbers, and text in a spreadsheet?

// Switch the document locale to match the target audience's region in a spreadsheet.

let worksheet = Api.GetActiveSheet();
Api.SetLocale("en-CA");
worksheet.GetRange("A1").SetValue("A sample spreadsheet with the language set to English (Canada).");