class OoxmlParser::Chartsheet

Class for storing data of chartsheets files

Attributes

sheet_views[RW]

@return [Array, SheetView] array of views

Public Class Methods

new(parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/xlsx_parser/workbook/chartsheet.rb, line 9
def initialize(parent: nil)
  @sheet_views = []
  super
end

Public Instance Methods

parse(file) click to toggle source

Parse Chartsheet object @param file [String] file to parse @return [Chartsheet] result of parsing

# File lib/ooxml_parser/xlsx_parser/workbook/chartsheet.rb, line 17
def parse(file)
  root_object.add_to_xmls_stack(root_object.root_subfolder + file)
  doc = parse_xml(root_object.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
  root_object.xmls_stack.pop
  self
end