Class: OOXML::Excel::Sheet::Column

Inherits:
Object
  • Object
show all
Defined in:
lib/ooxml_excel/sheet.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**attrs) ⇒ Column

Returns a new instance of Column.



114
115
116
# File 'lib/ooxml_excel/sheet.rb', line 114

def initialize(**attrs)
  attrs.each { |property, value| send("#{property}=", value)}
end

Instance Attribute Details

#custom_widthObject

Returns the value of attribute custom_width.



112
113
114
# File 'lib/ooxml_excel/sheet.rb', line 112

def custom_width
  @custom_width
end

#hiddenObject Also known as: hidden?

Returns the value of attribute hidden.



112
113
114
# File 'lib/ooxml_excel/sheet.rb', line 112

def hidden
  @hidden
end

#idObject

Returns the value of attribute id.



112
113
114
# File 'lib/ooxml_excel/sheet.rb', line 112

def id
  @id
end

#id_rangeObject

Returns the value of attribute id_range.



112
113
114
# File 'lib/ooxml_excel/sheet.rb', line 112

def id_range
  @id_range
end

#widthObject

Returns the value of attribute width.



112
113
114
# File 'lib/ooxml_excel/sheet.rb', line 112

def width
  @width
end

Class Method Details

.load_from_node(column_node) ⇒ Object



118
119
120
121
122
123
124
125
# File 'lib/ooxml_excel/sheet.rb', line 118

def self.load_from_node(column_node)
  hidden_attr = column_node.attributes["hidden"]
  new(id: column_node.attributes["min"].try(:value),
      width: column_node.attributes["width"].try(:value),
      custom_width: column_node.attributes["custom_width"].try(:value),
      id_range: (column_node.attributes["min"].value.to_i..column_node.attributes["max"].value.to_i).to_a,
      hidden: (hidden_attr.present?) ? hidden_attr.value == "1" : false)
end