Class: OoxmlParser::XlsxColumnProperties
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::XlsxColumnProperties
- Defined in:
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb
Overview
Properties of XLSX column
Instance Attribute Summary collapse
-
#best_fit ⇒ True, False
specified column(s) is set to ‘best fit’.
-
#custom_width ⇒ True, False
Is width custom.
-
#from ⇒ Object
Returns the value of attribute from.
-
#style ⇒ Object
Returns the value of attribute style.
-
#to ⇒ Object
Returns the value of attribute to.
-
#width ⇒ Object
Returns the value of attribute width.
Attributes inherited from OOXMLDocumentObject
Class Method Summary collapse
Instance Method Summary collapse
-
#parse(node) ⇒ XlsxColumnProperties
Parse XlsxColumnProperties object.
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, #initialize, unzip_file, #with_data?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
This class inherits a constructor from OoxmlParser::OOXMLDocumentObject
Instance Attribute Details
#best_fit ⇒ True, False
specified column(s) is set to ‘best fit’
9 10 11 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb', line 9 def best_fit @best_fit end |
#custom_width ⇒ True, False
Returns is width custom.
6 7 8 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb', line 6 def custom_width @custom_width end |
#from ⇒ Object
Returns the value of attribute from.
4 5 6 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb', line 4 def from @from end |
#style ⇒ Object
Returns the value of attribute style.
4 5 6 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb', line 4 def style @style end |
#to ⇒ Object
Returns the value of attribute to.
4 5 6 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb', line 4 def to @to end |
#width ⇒ Object
Returns the value of attribute width.
4 5 6 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb', line 4 def width @width end |
Class Method Details
.parse_list(columns_width_node, parent: nil) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb', line 34 def self.parse_list(columns_width_node, parent: nil) columns = [] columns_width_node.xpath('xmlns:col').each do |col_node| col = XlsxColumnProperties.new(parent: parent).parse(col_node) columns << col end columns end |
Instance Method Details
#parse(node) ⇒ XlsxColumnProperties
Parse XlsxColumnProperties object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb', line 14 def parse(node) node.attributes.each do |key, value| case key when 'min' @from = value.value.to_i when 'max' @to = value.value.to_i when 'style' @style = CellStyle.new(parent: self).parse(value.value) when 'width' @width = value.value.to_f - 0.7109375 when 'customWidth' @custom_width = option_enabled?(node, 'customWidth') when 'bestFit' @best_fit = attribute_enabled?(value) end end self end |