Spread for WPF allows you to define custom names as identifiers to represent specific information. These custom names can reference cells, cell ranges, calculated values, or formulas. During evaluation, the formula processes the referenced name and returns the result to the formula's owner object.
Custom names can be defined at either the workbook level or the worksheet level, allowing flexibility in scope. Once defined, these custom names can be used in formulas to simplify referencing and enhance formula readability.
To create a custom name for a workbook, access the specified workbook and use the Add method of the INames interface. Once created, the custom name can be used in formulas for easier referencing and improved readability.
The following image illustrates the custom name defined for the formula.
Refer to the following example code to define custom name in the workbook.
To create a custom name for a worksheet, access the specified worksheet and use the Add method of the INames interface. When creating a custom name for a specific worksheet cell (e.g., cell A1 in worksheet [0]), you can reference it explicitly as "=!A1" or "=Sheet1!A1". Using "=A1" will associate the custom name with cell A1 of the currently active worksheet, rather than a specific one.
The following GIF illustrates how to define custom names for the "Total Sales" and "Total Sales (excluding Charles)" formulas within the worksheet.
Refer to the following example code to define a custom name in the worksheet.