Class: TableTransform::ExcelCreator

Inherits:
Object
  • Object
show all
Defined in:
lib/table_transform/excel_creator.rb

Overview

Creates excel file

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ ExcelCreator

Returns a new instance of ExcelCreator.



9
10
11
12
# File 'lib/table_transform/excel_creator.rb', line 9

def initialize(filename)
  @workbook = WriteXLSX.new(filename)
  @formats = {}
end

Instance Method Details

#add_tab(name, table) ⇒ Object



18
19
20
21
# File 'lib/table_transform/excel_creator.rb', line 18

def add_tab(name, table)
  set_formats(table.column_properties) if table.is_a?(TableTransform::Table)
  create_table(name, table)
end

#create!Object



14
15
16
# File 'lib/table_transform/excel_creator.rb', line 14

def create!
  @workbook.close
end