class OoxmlParser::XlsxColumnProperties
Properties of XLSX column
Attributes
@return [True, False] Flag indicating if the specified column(s) is set to ‘best fit’
@return [True, False] is width custom
@return [Integer] First column affected by this ‘column info’ record.
@return [Integer] Last column affected by this ‘column info’ record.
@return [Integer] First column affected by this ‘column info’ record.
@return [Integer] Last column affected by this ‘column info’ record.
@return [Float] width, in readable format
@return [Float] width in pixel, as stored in xml structure
Public Instance Methods
Source
# 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
Parse XlsxColumnProperties
object @param node [Nokogiri::XML:Element] node to parse @return [XlsxColumnProperties] result of parsing
Private Instance Methods
Source
# File lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_columns/xlsx_column_properties.rb, line 65 def calculate_width(value) value - 0.7109375 end
TODO: Currently width calculation use some magick number from old time ago
Actual formula is way more complicated and require data about font max width for single character. Read more in ECMA-376, §18.3.1.13
@param [Float] value raw value for width @return [Float] width value