diff options
Diffstat (limited to 'lib/axlsx/workbook/worksheet/data_validations.rb')
| -rw-r--r-- | lib/axlsx/workbook/worksheet/data_validations.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/axlsx/workbook/worksheet/data_validations.rb b/lib/axlsx/workbook/worksheet/data_validations.rb new file mode 100644 index 00000000..cdfcf375 --- /dev/null +++ b/lib/axlsx/workbook/worksheet/data_validations.rb @@ -0,0 +1,28 @@ +module Axlsx + + # A simple, self serializing class for storing conditional formattings + class DataValidations < SimpleTypedList + + # creates a new Tables object + def initialize(worksheet) + raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) + super DataValidation + @worksheet = worksheet + end + + # The worksheet that owns this collection of tables + # @return [Worksheet] + attr_reader :worksheet + + # serialize the conditional formattings + def to_xml_string(str = "") + return if empty? + str << "<dataValidations count='#{size}'>" + each { |item| item.to_xml_string(str) } + str << '</dataValidations>' + end + end + +end + + |
