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.5.13 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.5.12 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.5.11 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.5.10 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.5.9 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.5.8 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.5.7 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.5.6 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.5.5 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.5.4 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.5.3 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.5.2 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.5.1 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.5.0 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.4.4 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.4.3 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.4.2 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.4.1 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.4.0 app/serializers/agilibox/serializers/xlsx.rb
agilibox-1.3.6 app/serializers/agilibox/serializers/xlsx.rb