Class: Roo::Excelx::SheetDoc
- Defined in:
- lib/roo/excelx/sheet_doc.rb
Instance Method Summary collapse
- #cells(relationships) ⇒ Object
-
#dimensions ⇒ Object
Get the dimensions for the sheet.
-
#each_cell(row_xml) ⇒ Object
Yield each cell as Excelx::Cell to caller for given row xml.
-
#each_row_streaming(&block) ⇒ Object
Yield each row xml element to caller.
- #hyperlinks(relationships) ⇒ Object
-
#initialize(path, relationships, styles, shared_strings, workbook, options = {}) ⇒ SheetDoc
constructor
A new instance of SheetDoc.
Constructor Details
#initialize(path, relationships, styles, shared_strings, workbook, options = {}) ⇒ SheetDoc
Returns a new instance of SheetDoc.
5 6 7 8 9 10 11 12 |
# File 'lib/roo/excelx/sheet_doc.rb', line 5 def initialize(path, relationships, styles, shared_strings, workbook, = {}) super(path) @options = @relationships = relationships @styles = styles @shared_strings = shared_strings @workbook = workbook end |
Instance Method Details
#cells(relationships) ⇒ Object
14 15 16 |
# File 'lib/roo/excelx/sheet_doc.rb', line 14 def cells(relationships) @cells ||= extract_cells(relationships) end |
#dimensions ⇒ Object
Get the dimensions for the sheet. This is the upper bound of cells that might be parsed. (the document may be sparse so cell count is only upper bound)
25 26 27 |
# File 'lib/roo/excelx/sheet_doc.rb', line 25 def dimensions @dimensions ||= extract_dimensions end |
#each_cell(row_xml) ⇒ Object
Yield each cell as Excelx::Cell to caller for given row xml
36 37 38 39 40 41 42 |
# File 'lib/roo/excelx/sheet_doc.rb', line 36 def each_cell(row_xml) return [] unless row_xml row_xml.children.each do |cell_element| key = ::Roo::Utils.ref_to_key(cell_element['r']) yield cell_from_xml(cell_element, hyperlinks(@relationships)[key]) end end |
#each_row_streaming(&block) ⇒ Object
Yield each row xml element to caller
30 31 32 |
# File 'lib/roo/excelx/sheet_doc.rb', line 30 def each_row_streaming(&block) Roo::Utils.each_element(@path, 'row', &block) end |
#hyperlinks(relationships) ⇒ Object
18 19 20 |
# File 'lib/roo/excelx/sheet_doc.rb', line 18 def hyperlinks(relationships) @hyperlinks ||= extract_hyperlinks(relationships) end |