Sha256: d6fb1650e4f4e19ee2e7a2a40d6d260e3a33d74e16d24a6a10d1563ae15d09d2

Contents?: true

Size: 764 Bytes

Versions: 7

Compression:

Stored size: 764 Bytes

Contents

# frozen_string_literal: true

wb = xlsx_package.workbook

title = wb.styles.add_style(
  b: true, sz: 13, bg_color: '1a172f', fg_color: 'ebebeb'
  # alignment: { horizontal: :center, vertical: :center }
)

wb.add_worksheet(name: @clase_modelo.nombre_plural) do |sheet|
  headers = atributos_para_listar.map { |a, _sort_by| @clase_modelo.human_attribute_name(a) }
  headers.append 'ID interno'
  sheet.add_row(headers, style: headers.map { title })

  @collection.decorate.each do |object|
    array = atributos_para_listar.map do |att, _sort_by|
      field = unsuffixed(att)
      if object.respond_to?(:"#{field}_text")
        field = :"#{field}_text"
      end
      object.send(field)
    end
    array.append object.to_key
    sheet.add_row array
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pg_rails-7.6.28 pg_engine/app/views/pg_engine/base/download.xlsx.axlsx
pg_rails-7.6.27 pg_engine/app/views/pg_engine/base/download.xlsx.axlsx
pg_rails-7.6.26 pg_engine/app/views/pg_engine/base/download.xlsx.axlsx
pg_rails-7.6.25 pg_engine/app/views/pg_engine/base/download.xlsx.axlsx
pg_rails-7.6.24 pg_engine/app/views/pg_engine/base/download.xlsx.axlsx
pg_rails-7.6.24.pre.5 pg_engine/app/views/pg_engine/base/download.xlsx.axlsx
pg_rails-7.6.24.pre.4 pg_engine/app/views/pg_engine/base/download.xlsx.axlsx