Class: OoxmlParser::SheetView

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/xlsx_parser/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

#==, #boolean_attribute_value, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ SheetView

Returns a new instance of SheetView.



22
23
24
25
26
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_view.rb', line 22

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

Instance Attribute Details

#paneObject

Returns the value of attribute pane.



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

def pane
  @pane
end

#selectionSelection (readonly)

Returns Properties of selection.

Returns:



20
21
22
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_view.rb', line 20

def selection
  @selection
end

#show_gridlinesTrue, False

Returns Flag indicating whether this sheet should display gridlines.

Returns:

  • (True, False)

    Flag indicating whether this sheet should display gridlines.



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

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.



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

def show_row_column_headers
  @show_row_column_headers
end

#top_left_cellCoordinates (readonly)

Returns Reference to the top left cell.

Returns:



14
15
16
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_view.rb', line 14

def top_left_cell
  @top_left_cell
end

#workbook_view_idInteger (readonly)

Returns Id of workbook view.

Returns:

  • (Integer)

    Id of workbook view



16
17
18
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_view.rb', line 16

def workbook_view_id
  @workbook_view_id
end

#zoom_scaleInteger (readonly)

Returns Zoom scale.

Returns:

  • (Integer)

    Zoom scale



18
19
20
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_view.rb', line 18

def zoom_scale
  @zoom_scale
end

Instance Method Details

#parse(node) ⇒ SheetView

Parse SheetView object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_view.rb', line 31

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'showGridLines'
      @show_gridlines = boolean_attribute_value(value)
    when 'showRowColHeaders'
      @show_row_column_headers = boolean_attribute_value(value)
    when 'topLeftCell'
      @top_left_cell = Coordinates.new.parse_string(value.value)
    when 'workbookViewId'
      @workbook_view_id = value.value.to_i
    when 'zoomScale'
      @zoom_scale = value.value.to_i
    end
  end

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