Sha256: b4fb57e42609a4d5236c02e4e9180092c6e02ade8f71b132ac3135aae11c3ad1
Contents?: true
Size: 971 Bytes
Versions: 2
Compression:
Stored size: 971 Bytes
Contents
require_relative '../lib/fast_excel' `rm example_filters.xlsx` if File.exist?('example_filters.xlsx') workbook = FastExcel.open("example_filters.xlsx", constant_memory: false) workbook.default_format.set( font_size: 0, # user's default #font_family: "Arial" ) # pp workbook.default_format worksheet = workbook.add_worksheet("Payments Report") p worksheet[:filter_on] FastExcel.print_ffi_obj(worksheet) bold = workbook.bold_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", "complete"], bold) for i in 1..1000 worksheet.write_row(i, ["Hello", (rand * 10_000_000).round(2), Time.now, i % 2 == 0]) end worksheet.enable_filters!(end_col: 3) workbook.close puts "Saved to file example_filters.xlsx"
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fast_excel-0.4.0 | examples/example_filters.rb |
fast_excel-0.3.0 | examples/example_filters.rb |