Sha256: d7c5bfc7144e28ffedd9635716330c25a6f21dbd2085c66d60e0a6ab7b2973c5

Contents?: true

Size: 819 Bytes

Versions: 2

Compression:

Stored size: 819 Bytes

Contents

# Properties of XLSX column
module OoxmlParser
  class XlsxColumnProperties < OOXMLDocumentObject
    attr_accessor :from, :to, :width, :style

    def self.parse(col_node)
      col = XlsxColumnProperties.new
      col.from = col_node.attribute('min').value.to_i
      col.to = col_node.attribute('max').value.to_i
      col.style = CellStyle.parse(col_node.attribute('style').value) unless col_node.attribute('style').nil?
      col.width = col_node.attribute('width').value.to_f - 0.7109375 if OOXMLDocumentObject.option_enabled?(col_node, 'customWidth')
      col
    end

    def self.parse_list(columns_width_node)
      columns = []
      columns_width_node.xpath('xmlns:col').each do |col_node|
        col = XlsxColumnProperties.parse(col_node)
        columns << col
      end
      columns
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ooxml_parser-0.1.2 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb
ooxml_parser-0.1.1 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb