Method: Axlsx::DataValidation#initialize

Defined in:
lib/axlsx/workbook/worksheet/data_validation.rb

#initialize(options = {}) ⇒ DataValidation

Creates a new Axlsx::DataValidation object

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • formula1 (String)
  • formula2 (String)
  • allowBlank (Boolean)
    • A boolean value indicating whether the data validation allows the use of empty or blank entries.
  • error (String)
    • Message text of error alert.
  • errorStyle (Symbol)
    • The style of error alert used for this data validation.
  • errorTitle (String)
    • itle bar text of error alert.
  • operator (Symbol)
    • The relational operator used with this data validation.
  • prompt (String)
    • Message text of input prompt.
  • promptTitle (String)
    • Title bar text of input prompt.
  • showDropDown (Boolean)
    • A boolean value indicating whether to display a dropdown combo box for a list type data validation
  • showErrorMessage (Boolean)
    • A boolean value indicating whether to display the error alert message when an invalid value has been entered, according to the criteria specified.
  • showInputMessage (Boolean)
    • A boolean value indicating whether to display the input prompt message.
  • sqref (String)
    • Range over which data validation is applied, in "A1:B2" format.
  • type (Symbol)
    • The type of data validation.


158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/axlsx/workbook/worksheet/data_validation.rb', line 158

def initialize(options={})
  # defaults
  @formula1 = @formula2 = @error = @errorTitle = @operator = @prompt = @promptTitle = @sqref = nil
  @allowBlank = @showErrorMessage = true
  @showDropDown = @showInputMessage = false
  @type = :none
  @errorStyle = :stop
  
  options.each do |o|
    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
  end
end