Class: OoxmlParser::XlsxRow
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::XlsxRow
- Defined in:
- lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_row.rb
Overview
Single Row of XLSX
Instance Attribute Summary collapse
-
#cells_raw ⇒ Array<Cells>
readonly
Cells of row, as in xml structure.
-
#custom_height ⇒ True, False
True if the row height has been manually set.
-
#height ⇒ Object
Returns the value of attribute height.
-
#hidden ⇒ Object
Returns the value of attribute hidden.
-
#index ⇒ Integer
Indicates to which row in the sheet this <row> definition corresponds.
-
#style_index ⇒ Integer
readonly
Index of style of row.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#cells ⇒ Array<XlsxCell, nil>
List of cell in row, with nil, if cell data is not stored in xml.
-
#initialize(parent: nil) ⇒ XlsxRow
constructor
A new instance of XlsxRow.
-
#parse(node) ⇒ XlsxRow
Parse XlsxRow object.
-
#style ⇒ Xf?
Style of row or ‘nil` if not applied.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil) ⇒ XlsxRow
Returns a new instance of XlsxRow.
18 19 20 21 22 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_row.rb', line 18 def initialize(parent: nil) @cells_raw = [] @cells = [] super end |
Instance Attribute Details
#cells_raw ⇒ Array<Cells> (readonly)
Returns cells of row, as in xml structure.
14 15 16 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_row.rb', line 14 def cells_raw @cells_raw end |
#custom_height ⇒ True, False
Returns true if the row height has been manually set.
9 10 11 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_row.rb', line 9 def custom_height @custom_height end |
#height ⇒ Object
Returns the value of attribute height.
7 8 9 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_row.rb', line 7 def height @height end |
#hidden ⇒ Object
Returns the value of attribute hidden.
7 8 9 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_row.rb', line 7 def hidden @hidden end |
#index ⇒ Integer
Returns Indicates to which row in the sheet this <row> definition corresponds.
12 13 14 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_row.rb', line 12 def index @index end |
#style_index ⇒ Integer (readonly)
Returns index of style of row.
16 17 18 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_row.rb', line 16 def style_index @style_index end |
Instance Method Details
#cells ⇒ Array<XlsxCell, nil>
Returns list of cell in row, with nil, if cell data is not stored in xml.
53 54 55 56 57 58 59 60 61 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_row.rb', line 53 def cells return @cells if @cells.any? cells_raw.each do |cell| @cells[cell.coordinates.column_number.to_i - 1] = cell end @cells end |
#parse(node) ⇒ XlsxRow
Parse XlsxRow object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_row.rb', line 27 def parse(node) node.attributes.each do |key, value| case key when 'customHeight' @custom_height = option_enabled?(node, 'customHeight') when 'ht' @height = OoxmlSize.new(value.value.to_f, :point) when 'hidden' @hidden = option_enabled?(node, 'hidden') when 'r' @index = value.value.to_i when 's' @style_index = value.value.to_i end end node.xpath('*').each do |node_child| case node_child.name when 'c' @cells_raw << XlsxCell.new(parent: self).parse(node_child) end end self end |
#style ⇒ Xf?
Returns style of row or ‘nil` if not applied.
64 65 66 67 68 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_row.rb', line 64 def style return nil unless @style_index root_object.style_sheet.cell_xfs.xf_array[@style_index] end |