summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/workbook/worksheet/cols.rb
blob: d4595f299520327e0fae7a7d5b9ba0cd79840975 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module Axlsx

  # The cols class manages the col object used to manage column widths. 
  # This is where the magic happens with autowidth
  class Cols < SimpleTypedList

    def initialize(worksheet)
      raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet)
      super Col
      @worksheet = worksheet
    end

    def to_xml_string(str = '')
     return if empty?
     str << '<cols>'
     each { |item| item.to_xml_string(str) }
     str << '</cols>' 
    end
  end
end