Class: FDefinedNameBuilder
Methods
build()
build(): ISetDefinedNameMutationParam
Builds the defined name.
Returns
ISetDefinedNameMutationParam
The defined name mutation parameter.
Example
const workbook = univerAPI.getActiveWorkbook();
const definedNameBuilder = univerAPI.newDefinedName()
.setRef('Sheet1!$A$1')
.setName('MyDefinedName')
.build();
workbook.insertDefinedNameBuilder(definedNameBuilder);
load()
load(param): FDefinedNameBuilder
Parameters
Parameter | Type |
---|---|
param | ISetDefinedNameMutationParam |
Returns
setComment()
setComment(comment): FDefinedNameBuilder
Sets the comment of the defined name builder.
Parameters
Parameter | Type | Description |
---|---|---|
comment | string | The comment of the defined name. |
Returns
The defined name builder.
Example
const workbook = univerAPI.getActiveWorkbook();
const definedNameBuilder = univerAPI.newDefinedName()
.setComment('This is a comment')
.build();
workbook.insertDefinedNameBuilder(definedNameBuilder);
setFormula()
setFormula(formula): FDefinedNameBuilder
Sets the formula of the defined name builder.
Parameters
Parameter | Type | Description |
---|---|---|
formula | string | The formula of the defined name. |
Returns
The defined name builder.
Example
const workbook = univerAPI.getActiveWorkbook();
const definedNameBuilder = univerAPI.newDefinedName()
.setFormula('SUM(Sheet1!$A$1)')
.setName('MyDefinedName')
.build();
workbook.insertDefinedNameBuilder(definedNameBuilder);
setHidden()
setHidden(hidden): FDefinedNameBuilder
Sets the hidden status of the defined name builder.
Parameters
Parameter | Type | Description |
---|---|---|
hidden | boolean | The hidden status of the defined name. |
Returns
The defined name builder.
Example
const workbook = univerAPI.getActiveWorkbook();
const definedNameBuilder = univerAPI.newDefinedName()
.setHidden(true)
.build();
workbook.insertDefinedNameBuilder(definedNameBuilder);
setName()
setName(name): FDefinedNameBuilder
Sets the name of the defined name builder.
Parameters
Parameter | Type | Description |
---|---|---|
name | string | The name of the defined name. |
Returns
The defined name builder.
Example
const workbook = univerAPI.getActiveWorkbook();
const definedNameBuilder = univerAPI.newDefinedName()
.setName('MyDefinedName')
.build();
workbook.insertDefinedNameBuilder(definedNameBuilder);
setRef()
setRef(a1Notation): FDefinedNameBuilder
Sets the reference of the defined name builder.
Parameters
Parameter | Type | Description |
---|---|---|
a1Notation | string | The reference of the defined name. |
Returns
The defined name builder.
Example
const workbook = univerAPI.getActiveWorkbook();
const definedNameBuilder = univerAPI.newDefinedName()
.setRef('Sheet1!$A$1')
.build();
workbook.insertDefinedNameBuilder(definedNameBuilder);
setRefByRange()
setRefByRange(
row,
column,
numRows,
numColumns): FDefinedNameBuilder
Sets the reference of the defined name builder by range .
Parameters
Parameter | Type | Description |
---|---|---|
row | number | The start row of the range. |
column | number | The start column of the range. |
numRows | number | The number of rows in the range. |
numColumns | number | The number of columns in the range. |
Returns
The defined name builder.
Example
const workbook = univerAPI.getActiveWorkbook();
const definedNameBuilder = univerAPI.newDefinedName()
.setRefByRange(1, 3, 2, 5)
.build();
workbook.insertDefinedNameBuilder(definedNameBuilder);