Class: OoxmlParser::SheetProtection
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::SheetProtection
- Defined in:
- lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb
Overview
Class for parsing <sheetProtection> tag
Instance Attribute Summary collapse
-
#algorithm_name ⇒ String
readonly
Name of hashing algorithm.
-
#auto_filter ⇒ True, False
readonly
Specifies if using autofilter is not allowed on protected sheet.
-
#delete_columns ⇒ True, False
readonly
Specifies if deleting columns is not allowed on protected sheet.
-
#delete_rows ⇒ True, False
readonly
Specifies if deleting rows is not allowed on protected sheet.
-
#format_cells ⇒ True, False
readonly
Specifies if formatting cells is not allowed on protected sheet.
-
#format_columns ⇒ True, False
readonly
Specifies if formatting columns is not allowed on protected sheet.
-
#format_rows ⇒ True, False
readonly
Specifies if formatting rows is not allowed on protected sheet.
-
#hash_value ⇒ String
readonly
Hash value for the password.
-
#insert_columns ⇒ True, False
readonly
Specifies if inserting columns is not allowed on protected sheet.
-
#insert_hyperlinks ⇒ True, False
readonly
Specifies if inserting hyperlinks is not allowed on protected sheet.
-
#insert_rows ⇒ True, False
readonly
Specifies if inserting rows is not allowed on protected sheet.
-
#objects ⇒ True, False
readonly
Specifies if editing objects is not allowed on protected sheet.
-
#pivot_tables ⇒ True, False
readonly
Specifies if using pivot tables is not allowed on protected sheet.
-
#salt_value ⇒ String
readonly
Salt value for the password.
-
#scenarios ⇒ True, False
readonly
Specifies if editing scenarios is not allowed on protected sheet.
-
#select_locked_cells ⇒ True, False
readonly
Specifies if selecting locked cells is not allowed on protected sheet.
-
#select_unlocked_cells ⇒ True, False
readonly
Specifies if selecting unlocked cells is not allowed on protected sheet.
-
#sheet ⇒ True, False
readonly
Specifies if sheet is protected.
-
#sort ⇒ True, False
readonly
Specifies if sorting is not allowed on protected sheet.
-
#spin_count ⇒ Integer
readonly
Number of times the hashing function shall be iteratively run.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(parent: nil) ⇒ SheetProtection
constructor
A new instance of SheetProtection.
-
#parse(node) ⇒ Sheet
Parse SheetProtection data.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil) ⇒ SheetProtection
Returns a new instance of SheetProtection.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# 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 |
Instance Attribute Details
#algorithm_name ⇒ String (readonly)
Returns Name of hashing algorithm.
7 8 9 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 7 def algorithm_name @algorithm_name end |
#auto_filter ⇒ True, False (readonly)
Returns Specifies if using autofilter is not allowed on protected sheet.
17 18 19 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 17 def auto_filter @auto_filter end |
#delete_columns ⇒ True, False (readonly)
Returns Specifies if deleting columns is not allowed on protected sheet.
19 20 21 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 19 def delete_columns @delete_columns end |
#delete_rows ⇒ True, False (readonly)
Returns Specifies if deleting rows is not allowed on protected sheet.
21 22 23 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 21 def delete_rows @delete_rows end |
#format_cells ⇒ True, False (readonly)
Returns Specifies if formatting cells is not allowed on protected sheet.
23 24 25 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 23 def format_cells @format_cells end |
#format_columns ⇒ True, False (readonly)
Returns Specifies if formatting columns is not allowed on protected sheet.
25 26 27 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 25 def format_columns @format_columns end |
#format_rows ⇒ True, False (readonly)
Returns Specifies if formatting rows is not allowed on protected sheet.
27 28 29 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 27 def format_rows @format_rows end |
#hash_value ⇒ String (readonly)
Returns Hash value for the password.
9 10 11 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 9 def hash_value @hash_value end |
#insert_columns ⇒ True, False (readonly)
Returns Specifies if inserting columns is not allowed on protected sheet.
29 30 31 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 29 def insert_columns @insert_columns end |
#insert_hyperlinks ⇒ True, False (readonly)
Returns Specifies if inserting hyperlinks is not allowed on protected sheet.
33 34 35 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 33 def insert_hyperlinks @insert_hyperlinks end |
#insert_rows ⇒ True, False (readonly)
Returns Specifies if inserting rows is not allowed on protected sheet.
31 32 33 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 31 def insert_rows @insert_rows end |
#objects ⇒ True, False (readonly)
Returns Specifies if editing objects is not allowed on protected sheet.
35 36 37 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 35 def objects @objects end |
#pivot_tables ⇒ True, False (readonly)
Returns Specifies if using pivot tables is not allowed on protected sheet.
37 38 39 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 37 def pivot_tables @pivot_tables end |
#salt_value ⇒ String (readonly)
Returns Salt value for the password.
11 12 13 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 11 def salt_value @salt_value end |
#scenarios ⇒ True, False (readonly)
Returns Specifies if editing scenarios is not allowed on protected sheet.
39 40 41 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 39 def scenarios @scenarios end |
#select_locked_cells ⇒ True, False (readonly)
Returns Specifies if selecting locked cells is not allowed on protected sheet.
41 42 43 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 41 def select_locked_cells @select_locked_cells end |
#select_unlocked_cells ⇒ True, False (readonly)
Returns Specifies if selecting unlocked cells is not allowed on protected sheet.
43 44 45 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 43 def select_unlocked_cells @select_unlocked_cells end |
#sheet ⇒ True, False (readonly)
Returns Specifies if sheet is protected.
15 16 17 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 15 def sheet @sheet end |
#sort ⇒ True, False (readonly)
Returns Specifies if sorting is not allowed on protected sheet.
45 46 47 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 45 def sort @sort end |
#spin_count ⇒ Integer (readonly)
Returns Number of times the hashing function shall be iteratively run.
13 14 15 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/sheet_protection.rb', line 13 def spin_count @spin_count end |
Instance Method Details
#parse(node) ⇒ Sheet
Parse SheetProtection data
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# 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 |