Sha256: b728af1a33f4da3121b8f1c1cd8719c49b3418480e7662673dfc59cb5ef6cd85

Contents?: true

Size: 835 Bytes

Versions: 4

Compression:

Stored size: 835 Bytes

Contents

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 = Nokogiri::XML(File.open(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

4 entries across 4 versions & 1 rubygems

Version Path
ooxml_parser-0.4.1 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb
ooxml_parser-0.4.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb
ooxml_parser-0.3.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb
ooxml_parser-0.2.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb