Class: OpenXml::Xlsx::Elements::Row
- Inherits:
-
Object
- Object
- OpenXml::Xlsx::Elements::Row
- Defined in:
- lib/openxml/xlsx/elements/row.rb
Instance Attribute Summary collapse
-
#cells ⇒ Object
readonly
Returns the value of attribute cells.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#hidden ⇒ Object
readonly
Returns the value of attribute hidden.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#worksheet ⇒ Object
readonly
Returns the value of attribute worksheet.
Instance Method Summary collapse
- #add_cell(attributes) ⇒ Object
-
#initialize(worksheet, options = {}) ⇒ Row
constructor
A new instance of Row.
- #to_xml(xml) ⇒ Object
Constructor Details
#initialize(worksheet, options = {}) ⇒ Row
Returns a new instance of Row.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/openxml/xlsx/elements/row.rb', line 7 def initialize(worksheet, ={}) @worksheet = worksheet @number = .fetch(:number) @height = [:height] @hidden = [:hidden] @cells = [] Array([:cells]).each do |attributes| add_cell attributes end end |
Instance Attribute Details
#cells ⇒ Object (readonly)
Returns the value of attribute cells.
5 6 7 |
# File 'lib/openxml/xlsx/elements/row.rb', line 5 def cells @cells end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
5 6 7 |
# File 'lib/openxml/xlsx/elements/row.rb', line 5 def height @height end |
#hidden ⇒ Object (readonly)
Returns the value of attribute hidden.
5 6 7 |
# File 'lib/openxml/xlsx/elements/row.rb', line 5 def hidden @hidden end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
5 6 7 |
# File 'lib/openxml/xlsx/elements/row.rb', line 5 def number @number end |
#worksheet ⇒ Object (readonly)
Returns the value of attribute worksheet.
5 6 7 |
# File 'lib/openxml/xlsx/elements/row.rb', line 5 def worksheet @worksheet end |
Instance Method Details
#add_cell(attributes) ⇒ Object
19 20 21 |
# File 'lib/openxml/xlsx/elements/row.rb', line 19 def add_cell(attributes) cells.push Xlsx::Elements::Cell.new(self, attributes) end |
#to_xml(xml) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/openxml/xlsx/elements/row.rb', line 23 def to_xml(xml) attributes = {"r" => number} attributes.merge!("ht" => height, "customHeight" => 1) if height attributes.merge!("hidden" => 1) if hidden xml.row(attributes) do cells.each do |cell| cell.to_xml(xml) end end end |