EasyAxlsx
This is gem lets you generate axlsx object of an any class. Very easy.
TODO: Description readme.
Installation
$ gem install easy_axlsx
or in your Gemfile
gem 'easy_axlsx'
Examples
class User
include EasyAxlsx::ClassConfig
attr_reader :id, :name, :last_name
def initialize(args = {})
@id = args.fetch(:id)
@name = args.fetch(:name)
@last_name = args.fetch(:last_name)
end
def second_name
end
as_easy_axlsx_fields :id, :name, :last_name
as_easy_axlsx_widths 1.5, 2.5, 3.5
end
@row_items = (1...3).map { |i| User.new(id: i, name: "Name#{i}", last_name: "Last Name #{i}") }
@axlsx_object = EasyAxlsx::Builder.build @row_items
@axlsx_object.package.serialize('simple.xlsx')
This code generate next xlsx file