Sha256: e053f2339146e236e56e2374fca0fbeb91dee8720e258482335e9815c176ff58

Contents?: true

Size: 851 Bytes

Versions: 3

Compression:

Stored size: 851 Bytes

Contents

# frozen_string_literal: true

module OoxmlParser
  # Class for storing data of chartsheets files
  class Chartsheet < OOXMLDocumentObject
    # @return [Array, SheetView] array of views
    attr_accessor :sheet_views

    def initialize(parent: nil)
      @sheet_views = []
      @parent = parent
    end

    def parse(file)
      OOXMLDocumentObject.add_to_xmls_stack(OOXMLDocumentObject.root_subfolder + file)
      doc = parse_xml(OOXMLDocumentObject.current_xml)
      node = doc.xpath('//xmlns:chartsheet').first
      node.xpath('*').each do |node_child|
        case node_child.name
        when 'sheetViews'
          node_child.xpath('*').each do |view_child|
            @sheet_views << SheetView.new(parent: self).parse(view_child)
          end
        end
      end
      OOXMLDocumentObject.xmls_stack.pop
      self
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ooxml_parser-0.6.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb
ooxml_parser-0.5.1 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb
ooxml_parser-0.5.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb