Class: Axlsx::DefinedName
- Inherits:
-
Object
- Object
- Axlsx::DefinedName
- Includes:
- Accessors, OptionsParser, SerializedAttributes
- Defined in:
- lib/axlsx/workbook/defined_name.rb
Overview
This element defines the defined names that are defined within this workbook. Defined names are descriptive text that is used to represents a cell, range of cells, formula, or constant value. Use easy-to-understand names, such as Products, to refer to hard to understand ranges, such as Sales!C20:C30. A defined name in a formula can make it easier to understand the purpose of the formula. Names are available to any sheet. Names can also be used to represent formulas or values that do not change (constants).
You can also link to a defined name in another workbook, or define a name that refers to cells in another workbook.
A compliant producer or consumer considers a defined name in the range A1-XFD1048576 to be an error. All other names outside this range can be defined as names and overrides a cell reference if an ambiguity exists.
Instance Attribute Summary collapse
-
#local_sheet_id ⇒ Object
Returns the value of attribute local_sheet_id.
Instance Method Summary collapse
-
#initialize(formula, options = {}) ⇒ DefinedName
constructor
creates a new DefinedName.
- #to_xml_string(str = +'')) ⇒ Object
Methods included from OptionsParser
Methods included from SerializedAttributes
included, #serialized_attributes, #serialized_element_attributes, #serialized_tag
Constructor Details
#initialize(formula, options = {}) ⇒ DefinedName
creates a new DefinedName.
102 103 104 105 |
# File 'lib/axlsx/workbook/defined_name.rb', line 102 def initialize(formula, = {}) @formula = formula end |
Instance Attribute Details
#local_sheet_id ⇒ Object
Returns the value of attribute local_sheet_id.
107 108 109 |
# File 'lib/axlsx/workbook/defined_name.rb', line 107 def local_sheet_id @local_sheet_id end |
Instance Method Details
#to_xml_string(str = +'')) ⇒ Object
123 124 125 126 127 128 129 |
# File 'lib/axlsx/workbook/defined_name.rb', line 123 def to_xml_string(str = +'') raise ArgumentError, 'you must specify the name for this defined name. Please read the documentation for Axlsx::DefinedName for more details' unless name str << '<definedName ' << 'name="' << name << '" ' serialized_attributes str str << '>' << @formula << '</definedName>' end |