Sha256: 464bda50656449da819938bbd62e3b9d3db1e568340451a560ecf2108f620392
Contents?: true
Size: 1.08 KB
Versions: 5
Compression:
Stored size: 1.08 KB
Contents
require_relative './lib/fast_excel' require 'pp' workbook = FastExcel.open("ffi_example.xlsx", constant_memory: true) workbook.default_format.set( font_size: 0, # user's default #font_family: "Arial" ) # pp workbook.default_format worksheet = workbook.add_worksheet("Payments Report") bold = workbook.bold_cell_format worksheet.set_column(0, 0, FastExcel::DEF_COL_WIDTH, bold) price = workbook.number_format("#,##0.00") worksheet.set_column(1, 1, 20, price) date_format = workbook.number_format("[$-409]m/d/yy h:mm AM/PM;@") worksheet.set_column(2, 2, 20, date_format) worksheet.write_row(0, ["message", "price", "date"], bold) for i in 1..1000 worksheet.write_row(i, ["Hello", (rand * 10_000_000).round(2), Time.now]) # Or manually # worksheet.write_string(i, 0, "Hello", nil) # worksheet.write_number(i, 1, (rand * 10_000_000).round(2), nil) # date = Libxlsxwriter::Datetime.new # date[:year] = 2017 # date[:month] = 2 # date[:day] = 24 # date[:hour] = i % 24 # date[:min] = i % 60 # date[:sec] = i % 60 # worksheet.write_datetime(i, 2, date, nil) end workbook.close
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
fast_excel-0.2.0 | examples/example.rb |
fast_excel-0.1.7 | example.rb |
fast_excel-0.1.6 | example.rb |
fast_excel-0.1.5 | example.rb |
fast_excel-0.1.4 | example.rb |