diff options
| author | Randy Morgan <[email protected]> | 2012-10-18 14:37:36 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-10-18 14:37:36 +0900 |
| commit | 4cd5db0a79a72a6f887fa231dbfab2fcd09c4214 (patch) | |
| tree | 26b36d44f7b974d02740427057e1a8480bdca3ef | |
| parent | 61ed7ca336d2372af25b40a6bb5e5ce872871b8f (diff) | |
| download | caxlsx-4cd5db0a79a72a6f887fa231dbfab2fcd09c4214.tar.gz caxlsx-4cd5db0a79a72a6f887fa231dbfab2fcd09c4214.zip | |
Added support for custom defined names by removing _xlnm prefixed values validation
| -rw-r--r-- | lib/axlsx/workbook/defined_name.rb | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/lib/axlsx/workbook/defined_name.rb b/lib/axlsx/workbook/defined_name.rb index 833093fd..b55856de 100644 --- a/lib/axlsx/workbook/defined_name.rb +++ b/lib/axlsx/workbook/defined_name.rb @@ -55,9 +55,9 @@ module Axlsx # creates a new DefinedName. # @param [String] formula - the formula the defined name references # @param [Hash] options - A hash of key/value pairs that will be mapped to this instances attributes. - # + # # @option [String] name - Specifies the name that appears in the user interface for the defined name. - # This attribute is required. + # This attribute is required. # The following built-in names are defined in this SpreadsheetML specification: # Print # _xlnm.Print_Area: this defined name specifies the workbook's print area. @@ -111,25 +111,13 @@ module Axlsx @local_sheet_id = value end - string_attr_accessor :short_cut_key, :status_bar, :help, :description, :custom_menu, :comment + string_attr_accessor :short_cut_key, :status_bar, :help, :description, :custom_menu, :comment, :name, :formula - # boolean attributes that will be added when this class is evaluated boolean_attr_accessor :workbook_parameter, :publish_to_server, :xlm, :vb_proceedure, :function, :hidden serializable_attributes :short_cut_key, :status_bar, :help, :description, :custom_menu, :comment, :workbook_parameter, :publish_to_server, :xlm, :vb_proceedure, :function, :hidden, :name, :local_sheet_id - - attr_reader :name - # The name of this defined name. Please refer to the class documentation for more information - def name=(value) - Axlsx::RestrictionValidator.validate 'DefinedName.name', %w(_xlnm.Print_Area _xlnm.Print_Titles _xlnm.Criteria _xlnm._FilterDatabase _xlnm.Extract _xlnm.Consolidate_Area _xlnm.Database _xlnm.Sheet_Title), value - @name = value - end - - # The formula this defined name references - attr_reader :formula - 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 ' |
