class Crexcel::Workbook
- Crexcel::Workbook
- Reference
- Object
Overview
The Workbook Class is the main class of Crexcel. It create the file which will contains the worksheets.
NOTE Don't forget to call the close method in order to generate your xlsx file!
Defined in:
crexcel/workbook.crConstructors
-
.new(name : String)
The new method let you create a workbook, you only need one per file you want to generate.
Instance Method Summary
-
#add_worksheet(name : String)
Call this to add a worksheet to the workbook with a name.
-
#add_worksheet
Call this to add a worksheet to the workbook without giving it a name.
-
#close
This function close the workbook and generate a xlsx file.
- #dirs : Dirs
- #name : String
Constructor Detail
The new method let you create a workbook, you only need one per file you want to generate.
You must give a name to it :
my_workbook = Workbook.new("thing.xlsx")
NOTE You are not forced to give the extension, if you type Workbook.new("thing")
it will still create a 'thing.xlsx' file.
Instance Method Detail
Call this to add a worksheet to the workbook with a name.
It returns a Worksheet object
workbook = Workbook.new("thing.xlsx")
first_worksheet = workbook.add_worksheet("test")
Call this to add a worksheet to the workbook without giving it a name.
It returns a Worksheet object
workbook = Workbook.new("thing.xlsx")
first_worksheet = workbook.add_worksheet
This function close the workbook and generate a xlsx file. You MUST call this function at the end of you script for each Workbook created. If you don't, this WILL NOT generate the xlsx file.
OPTIMIZE In the future, not closing a Workbook will raise an error instead of silently not generate the file.