class Xls::Spreadsheet
- Xls::Spreadsheet
- Reference
- Object
Overview
A Xls::Spreadsheet
represents the document and contains metadata.
Included Modules
Defined in:
xls/helpers/constants.crxls/spreadsheet/font.cr
xls/spreadsheet/format.cr
xls/spreadsheet/spreadsheet.cr
xls/spreadsheet/xf.cr
Constructors
-
.new(path : Path)
Creates a new
Xls::Spreadsheet
by providing a filepath -
.new(content : String)
Creates a new
Xls::Spreadsheet
by providing a string -
.new(io : IO)
Creates a new
Xls::Spreadsheet
by providing an IO
Class Method Summary
-
.debugging(enable = true, value : UInt32 = 1) : Nil
Toggles debug mode for
libxls
-
.open(file_or_content, & : Spreadsheet -> )
Yields a new
Xls::Spreadsheet
by providing a filepath or string or IO -
.open_file(path : Path, charset : String = "UTF-8")
Creates a new
Xls::Spreadsheet
by opening a file -
.xls_version : String
Returns
libxls
version
Instance Method Summary
-
#active_worksheet : Worksheet?
Returns the active (displayed) worksheet
-
#charset : String
Returns the encoding of the spreadsheet
-
#close : Nil
Closes the
Xls::Spreadsheet
and anyXls::Worksheet
's -
#closed? : Bool
Checks if the
Xls::Spreadsheet
is closed -
#codepage : UInt16
Returns the text encoding used to write byte strings, stored as MS Windows code page identifier
-
#css : String
Returns CSS for spreadsheet
-
#doc_summary : String
Returns the Document Summary of the spreadsheet
-
#fonts : Array(Font)
Returns information about a used font, including character formatting
-
#formats : Array(Format)
Returns information about a number format
-
#summary : String
Returns the Summary of the spreadsheet
- #to_unsafe : Pointer(Xls::LibXls::XlsWorkBook)
-
#validate! : Nil
Validates the spreadsheet
-
#worksheets : Array(Worksheet)
Returns worksheets for the spreadsheet
-
#xfs : Array(Xf)
Returns formatting information for cells, rows, columns or styles
Instance methods inherited from module Xls::InspectableMethods
inspect(io : IO) : Nil
inspect,
to_s(io : IO) : Nil
to_s
Constructor Detail
Creates a new Xls::Spreadsheet
by providing a filepath
Throws Xls::FileNotFound
if the filepath cannot be found.
Class Method Detail
Toggles debug mode for libxls
value controls different types of debugging information.
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.
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.
Instance Method Detail
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.
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.
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.
Returns information about a number format
All FORMAT records occur together in a sequential list.
Validates the spreadsheet
Can only be called once.
Throws Xls::Error
if spreadsheet is invalid.
Throws Xls::WorkbookParserException
if spreadsheet failed to parse.
Returns worksheets for the spreadsheet
Throws Xls::WorksheetParserException
if a worksheet failed to parse.
Returns formatting information for cells, rows, columns or styles