class

Xls::Spreadsheet

Inherits Xls::InspectableMethods < Reference < Object

A Xls::Spreadsheet represents the document and contains metadata.

Constructors

new(path : Path)

Creates a new Xls::Spreadsheet by providing a filepath

Throws Xls::FileNotFound if the filepath cannot be found.

Source
new(content : String)

Creates a new Xls::Spreadsheet by providing a string

Source
new(io : IO)

Creates a new Xls::Spreadsheet by providing an IO

Source

Class methods

debugging(enable = true, value : UInt32 = 1) : Nil

Toggles debug mode for libxls

value controls different types of debugging information.

Source
open(file_or_content, & : Spreadsheet -> )

Yields a new Xls::Spreadsheet by providing a filepath or string or IO

Calls #validate! on the newly created Xls::Spreadsheet.

Always invokes #close after yielding.

Source
open_file(path : Path, charset : String = "UTF-8")

Creates a new Xls::Spreadsheet by opening a file

charset can be an encoding other than UTF-8.

Throws Xls::FileNotFound if the filepath cannot be found.

Source
xls_version

Returns libxls version

Source

Instance methods

active_worksheet

Returns the active (displayed) worksheet

Source
charset

Returns the encoding of the spreadsheet

Source
close

Closes the Xls::Spreadsheet and any Xls::Worksheet's

Once a Xls::Spreadsheet is closed, it cannot be reopened in the same instance. You must create a new Xls::Spreadsheet instance to reopen it.

Source
closed?

Checks if the Xls::Spreadsheet is closed

Source
codepage

Returns the text encoding used to write byte strings, stored as MS Windows code page identifier

For more information see https://en.wikipedia.org/wiki/Character_encoding.

Source
css

Returns CSS for spreadsheet

Source
doc_summary

Returns the Document Summary of the spreadsheet

Source
fonts

Returns information about a used font, including character formatting

All FONT records occur together in a sequential list. Other records referencing a FONT record contain an index into this list.

The font with index 4 is omitted in all BIFF versions. This means the first four fonts have zero-based indexes, and the fifth font and all following fonts are refereced with one-based indexes. Use Xls::Spreadsheet::Font#real_index to access this particular sequence.

Source
formats

Returns information about a number format

All FORMAT records occur together in a sequential list.

Source
summary

Returns the Summary of the spreadsheet

Source
to_unsafe
Source
validate!

Validates the spreadsheet

Can only be called once.

Throws Xls::Error if spreadsheet is invalid.

Throws Xls::WorkbookParserException if spreadsheet failed to parse.

Source
worksheets

Returns worksheets for the spreadsheet

Throws Xls::WorksheetParserException if a worksheet failed to parse.

Source
xfs

Returns formatting information for cells, rows, columns or styles

Source

Nested types