Sha256: 69e246477b1342479bd13c99261f6e22669faedcfa8b2afc3a032e2d268608b8

Contents?: true

Size: 499 Bytes

Versions: 39

Compression:

Stored size: 499 Bytes

Contents

class Agilibox::Serializers::XLSX < Agilibox::Serializers::Base
  def render_inline
    xlsx.to_stream.read.force_encoding("BINARY")
  end

  def render_file(file_path)
    xlsx.serialize(file_path)
  end

  def xlsx
    @xlsx ||= Axlsx::Package.new do |p|
      p.workbook.add_worksheet do |sheet|
        data.each do |line|
          values = line.map { |value| self.class.format(value) }
          sheet.add_row(values)
        end
      end

      p.use_shared_strings = true
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
agilibox-1.3.5 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.3.4 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.3.3 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.3.2 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.3.1 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.3.0 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.2.3 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.2.2 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.2.1 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.2.0 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.1.0 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.0.15 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.0.14 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.0.13 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.0.12 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.0.11 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.0.10 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.0.9 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.0.8 app/serializers/agilibox/serializers/xlsx.rb