Class: OoxmlParser::SheetView

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb

Overview

Class for sheetView data

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, unzip_file, #with_data?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ SheetView

Returns a new instance of SheetView.



11
12
13
14
15
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb', line 11

def initialize(parent: nil)
  @parent = parent
  @show_gridlines = true
  @show_row_column_headers = true
end

Instance Attribute Details

#paneObject

Returns the value of attribute pane.



5
6
7
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb', line 5

def pane
  @pane
end

#show_gridlinesTrue, False

Returns Flag indicating whether this sheet should display gridlines.

Returns:

  • (True, False)

    Flag indicating whether this sheet should display gridlines.



7
8
9
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb', line 7

def show_gridlines
  @show_gridlines
end

#show_row_column_headersTrue, False

Returns Flag indicating whether the sheet should display row and column headings.

Returns:

  • (True, False)

    Flag indicating whether the sheet should display row and column headings.



9
10
11
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb', line 9

def show_row_column_headers
  @show_row_column_headers
end

Instance Method Details

#parse(node) ⇒ SheetView

Parse SheetView object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb', line 20

def parse(node)
  node.attributes.each_key do |key|
    case key
    when 'showGridLines'
      @show_gridlines = attribute_enabled?(node, key)
    when 'showRowColHeaders'
      @show_row_column_headers = attribute_enabled?(node, key)
    end
  end

  node.xpath('*').each do |node_child|
    case node_child.name
    when 'pane'
      @pane = Pane.new(parent: self).parse(node_child)
    end
  end
  self
end