class Crexcel::Workbook

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.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(name : String) #

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.


[View source]

Instance Method Detail

def add_worksheet(name : String) #

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")

[View source]
def add_worksheet #

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

[View source]
def close #

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.


[View source]
def dirs : Dirs #

[View source]
def name : String #

[View source]