Class: OoxmlParser::XlsxColumnProperties

Inherits:
OOXMLDocumentObject show all
Extended by:
Gem::Deprecate
Defined in:
lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_columns/xlsx_column_properties.rb

Overview

Properties of XLSX column

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

This class inherits a constructor from OoxmlParser::OOXMLDocumentObject

Instance Attribute Details

#best_fitTrue, False

specified column(s) is set to ‘best fit’

Returns:

  • (True, False)

    Flag indicating if the



11
12
13
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_columns/xlsx_column_properties.rb', line 11

def best_fit
  @best_fit
end

#custom_widthTrue, False

Returns is width custom.

Returns:

  • (True, False)

    is width custom



8
9
10
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_columns/xlsx_column_properties.rb', line 8

def custom_width
  @custom_width
end

#hiddenTrue, False (readonly)

specified column(s) is hidden

Returns:

  • (True, False)

    Flag indicating if the



14
15
16
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_columns/xlsx_column_properties.rb', line 14

def hidden
  @hidden
end

#maxInteger (readonly) Also known as: to

Returns Last column affected by this ‘column info’ record.

Returns:

  • (Integer)

    Last column affected by this ‘column info’ record.



18
19
20
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_columns/xlsx_column_properties.rb', line 18

def max
  @max
end

#minInteger (readonly) Also known as: from

Returns First column affected by this ‘column info’ record.

Returns:

  • (Integer)

    First column affected by this ‘column info’ record.



16
17
18
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_columns/xlsx_column_properties.rb', line 16

def min
  @min
end

#styleObject

Returns the value of attribute style.



6
7
8
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_columns/xlsx_column_properties.rb', line 6

def style
  @style
end

#widthFloat (readonly)

Returns width, in readable format.

Returns:

  • (Float)

    width, in readable format



22
23
24
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_columns/xlsx_column_properties.rb', line 22

def width
  @width
end

#width_rawFloat (readonly)

Returns width in pixel, as stored in xml structure.

Returns:

  • (Float)

    width in pixel, as stored in xml structure



20
21
22
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_columns/xlsx_column_properties.rb', line 20

def width_raw
  @width_raw
end

Instance Method Details

#parse(node) ⇒ XlsxColumnProperties

Parse XlsxColumnProperties object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_columns/xlsx_column_properties.rb', line 27

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'min'
      @min = value.value.to_i
    when 'max'
      @max = value.value.to_i
    when 'style'
      @style = root_object.style_sheet.cell_xfs.xf_array[value.value.to_i]
    when 'width'
      @width_raw = value.value.to_f
      @width = calculate_width(@width_raw)
    when 'customWidth'
      @custom_width = option_enabled?(node, 'customWidth')
    when 'bestFit'
      @best_fit = boolean_attribute_value(value)
    when 'hidden'
      @hidden = boolean_attribute_value(value)
    end
  end
  self
end