class OoxmlParser::SheetProtection

Class for parsing <sheetProtection> tag

Attributes

algorithm_name[R]

@return [String] Name of hashing algorithm

auto_filter[R]

@return [True, False] Specifies if using autofilter is not allowed on protected sheet

delete_columns[R]

@return [True, False] Specifies if deleting columns is not allowed on protected sheet

delete_rows[R]

@return [True, False] Specifies if deleting rows is not allowed on protected sheet

format_cells[R]

@return [True, False] Specifies if formatting cells is not allowed on protected sheet

format_columns[R]

@return [True, False] Specifies if formatting columns is not allowed on protected sheet

format_rows[R]

@return [True, False] Specifies if formatting rows is not allowed on protected sheet

hash_value[R]

@return [String] Hash value for the password

insert_columns[R]

@return [True, False] Specifies if inserting columns is not allowed on protected sheet

insert_rows[R]

@return [True, False] Specifies if inserting rows is not allowed on protected sheet

objects[R]

@return [True, False] Specifies if editing objects is not allowed on protected sheet

pivot_tables[R]

@return [True, False] Specifies if using pivot tables is not allowed on protected sheet

salt_value[R]

@return [String] Salt value for the password

scenarios[R]

@return [True, False] Specifies if editing scenarios is not allowed on protected sheet

select_locked_cells[R]

@return [True, False] Specifies if selecting locked cells is not allowed on protected sheet

select_unlocked_cells[R]

@return [True, False] Specifies if selecting unlocked cells is not allowed on protected sheet

sheet[R]

@return [True, False] Specifies if sheet is protected

sort[R]

@return [True, False] Specifies if sorting is not allowed on protected sheet

spin_count[R]

@return [Integer] Number of times the hashing function shall be iteratively run

Public Class Methods

new(parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb, line 47
def initialize(parent: nil)
  @objects = false
  @scenarios = false
  @select_locked_cells = false
  @select_unlocked_cells = false
  @auto_filter = true
  @delete_columns = true
  @delete_rows = true
  @format_cells = true
  @format_columns = true
  @format_rows = true
  @insert_columns = true
  @insert_rows = true
  @insert_hyperlinks = true
  @pivot_tables = true
  @sort = true
  super
end

Public Instance Methods

parse(node) click to toggle source

Parse SheetProtection data @param [Nokogiri::XML:Element] node with SheetProtection data @return [Sheet] value of SheetProtection

# File lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb, line 69
def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'algorithmName'
      @algorithm_name = value.value.to_s
    when 'hashValue'
      @hash_value = value.value.to_s
    when 'saltValue'
      @salt_value = value.value.to_s
    when 'spinCount'
      @spin_count = value.value.to_i
    when 'sheet'
      @sheet = attribute_enabled?(value)
    when 'autoFilter'
      @auto_filter = attribute_enabled?(value)
    when 'deleteColumns'
      @delete_columns = attribute_enabled?(value)
    when 'deleteRows'
      @delete_rows = attribute_enabled?(value)
    when 'formatCells'
      @format_cells = attribute_enabled?(value)
    when 'formatColumns'
      @format_columns = attribute_enabled?(value)
    when 'formatRows'
      @format_rows = attribute_enabled?(value)
    when 'insertColumns'
      @insert_columns = attribute_enabled?(value)
    when 'insertRows'
      @insert_rows = attribute_enabled?(value)
    when 'insertHyperlinks'
      @insert_hyperlinks = attribute_enabled?(value)
    when 'objects'
      @objects = attribute_enabled?(value)
    when 'pivotTables'
      @pivot_tables = attribute_enabled?(value)
    when 'scenarios'
      @scenarios = attribute_enabled?(value)
    when 'selectLockedCells'
      @select_locked_cells = attribute_enabled?(value)
    when 'selectUnlockedCells'
      @select_unlocked_cells = attribute_enabled?(value)
    when 'sort'
      @sort = attribute_enabled?(value)
    end
  end
  self
end