Skip to Content
ClassesFDefinedNameBuilder

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

ParameterType
paramISetDefinedNameMutationParam

Returns

FDefinedNameBuilder


setComment()

setComment(comment): FDefinedNameBuilder

Sets the comment of the defined name builder.

Parameters

ParameterTypeDescription
commentstringThe comment of the defined name.

Returns

FDefinedNameBuilder

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

ParameterTypeDescription
formulastringThe formula of the defined name.

Returns

FDefinedNameBuilder

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

ParameterTypeDescription
hiddenbooleanThe hidden status of the defined name.

Returns

FDefinedNameBuilder

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

ParameterTypeDescription
namestringThe name of the defined name.

Returns

FDefinedNameBuilder

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

ParameterTypeDescription
a1NotationstringThe reference of the defined name.

Returns

FDefinedNameBuilder

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

ParameterTypeDescription
rownumberThe start row of the range.
columnnumberThe start column of the range.
numRowsnumberThe number of rows in the range.
numColumnsnumberThe number of columns in the range.

Returns

FDefinedNameBuilder

The defined name builder.

Example

const workbook = univerAPI.getActiveWorkbook(); const definedNameBuilder = univerAPI.newDefinedName() .setRefByRange(1, 3, 2, 5) .build(); workbook.insertDefinedNameBuilder(definedNameBuilder);