[]
        
(Showing Draft Content)

Create Custom Names

Custom user-defined names are identifiers that represent information in the sheet. A custom name can refer to a range of cells or a formula.

You can define a custom name and then use the name in formulas. When the formula is evaluated, the custom name's value is referenced and evaluated. Use the addCustomName method to create a custom name.

The following code sample creates a custom name.

activeSheet.setValue(0, 0, 1);
activeSheet.setValue(0, 1, 2);
activeSheet.setValue(0, 2, 3);

// Add custom name by setting the isReadOnly parameter to true
activeSheet.addCustomName("customName1","=12", 0, 0, 'readonly', true);

activeSheet.addCustomName("customName2","Average(20,45)", 0, 0);
activeSheet.addCustomName("customName3", "=$B$1:$C$1", 0, 0);

activeSheet.setFormula(1, 0, "customName1");
activeSheet.setFormula(1, 1, "customName2");
activeSheet.setFormula(1, 2, "sum(customName3)");

SpreadJS does not allow you to change or remove read-only custom names from the Name Manager Dialog in SpreadJS Designer. If you select a read-only custom name, the Edit and Delete buttons are disabled, and double-clicking on the read-only custom name will be unresponsive. The read-only status of a custom name can only be set or changed using the API.


NameManagerDialog_readOnlyName