Sha256: 852baaa41449ab0bbf522a75eedf17d7f6f35b4dd0b83a3e9147d7b2d5d25463

Contents?: true

Size: 939 Bytes

Versions: 10

Compression:

Stored size: 939 Bytes

Contents

# returns an XML representation of all sheets of a spreadsheet file
module Roo
  module Formatters
    module XML
      def to_xml
        Nokogiri::XML::Builder.new do |xml|
          xml.spreadsheet do
            sheets.each do |sheet|
              self.default_sheet = sheet
              xml.sheet(name: sheet) do |x|
                if first_row && last_row && first_column && last_column
                  # sonst gibt es Fehler bei leeren Blaettern
                  first_row.upto(last_row) do |row|
                    first_column.upto(last_column) do |col|
                      next if empty?(row, col)

                      x.cell(cell(row, col),
                      row: row,
                      column: col,
                      type: celltype(row, col))
                    end
                  end
                end
              end
            end
          end
        end.to_xml
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
roo-2.10.1 lib/roo/formatters/xml.rb
roo-2.10.0 lib/roo/formatters/xml.rb
roo-2.9.0 lib/roo/formatters/xml.rb
ruh-roo-3.0.1 lib/roo/formatters/xml.rb
roo-2.8.3 lib/roo/formatters/xml.rb
roo-2.8.2 lib/roo/formatters/xml.rb
roo-2.8.1 lib/roo/formatters/xml.rb
roo-2.8.0 lib/roo/formatters/xml.rb
roo-2.7.1 lib/roo/formatters/xml.rb
roo-2.7.0 lib/roo/formatters/xml.rb