summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/workbook/worksheet/cols.rb
blob: c07043438099b1133548a330487361ce88fe57d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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

    # Serialize the Cols object
    # @param [String] str
    # @return [String]
    def to_xml_string(str = '')
     return if empty?
     str << '<cols>'
     each { |item| item.to_xml_string(str) }
     str << '</cols>'
    end
  end
end