Class: Axlsx::SheetProtection

Inherits:
Object
  • Object
show all
Includes:
Accessors, OptionsParser, SerializedAttributes
Defined in:
lib/axlsx/workbook/worksheet/sheet_protection.rb

Overview

The SheetProtection object manages worksheet protection options per sheet.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SerializedAttributes

#declared_attributes, included, #serialized_attributes, #serialized_element_attributes

Methods included from OptionsParser

#parse_options

Constructor Details

#initialize(options = {}) ⇒ SheetProtection

Creates a new SheetProtection instance

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • sheet (Boolean)

    @see SheetProtection#sheet

  • objects (Boolean)

    @see SheetProtection#objects

  • scenarios (Boolean)

    @see SheetProtection#scenarios

  • format_cells (Boolean)

    @see SheetProtection#objects

  • format_columns (Boolean)

    @see SheetProtection#format_columns

  • format_rows (Boolean)

    @see SheetProtection#format_rows

  • insert_columns (Boolean)

    @see SheetProtection#insert_columns

  • insert_rows (Boolean)

    @see SheetProtection#insert_rows

  • insert_hyperlinks (Boolean)

    @see SheetProtection#insert_hyperlinks

  • delete_columns (Boolean)

    @see SheetProtection#delete_columns

  • delete_rows (Boolean)

    @see SheetProtection#delete_rows

  • select_locked_cells (Boolean)

    @see SheetProtection#select_locked_cells

  • sort (Boolean)

    @see SheetProtection#sort

  • auto_filter (Boolean)

    @see SheetProtection#auto_filter

  • pivot_tables (Boolean)

    @see SheetProtection#pivot_tables

  • select_unlocked_cells (Boolean)

    @see SheetProtection#select_unlocked_cells

  • password. (String)

    The password required for unlocking. @see SheetProtection#password=



29
30
31
32
33
34
# File 'lib/axlsx/workbook/worksheet/sheet_protection.rb', line 29

def initialize(options={})
  @objects = @scenarios = @select_locked_cells = @select_unlocked_cells = false
  @sheet = @format_cells = @format_rows = @format_columns = @insert_columns = @insert_rows = @insert_hyperlinks = @delete_columns = @delete_rows = @sort = @auto_filter = @pivot_tables = true
  @password = nil
  parse_options options
end

Instance Attribute Details

#passwordString

Password hash default nil

Returns:

  • (String)


51
52
53
# File 'lib/axlsx/workbook/worksheet/sheet_protection.rb', line 51

def password
  @password
end

#salt_valueString (readonly)

Specifies the salt which was prepended to the user-supplied password before it was hashed using the hashing algorithm

Returns:

  • (String)


46
47
48
# File 'lib/axlsx/workbook/worksheet/sheet_protection.rb', line 46

def salt_value
  @salt_value
end

Instance Method Details

#to_xml_string(str = '') ⇒ String

Serialize the object

Parameters:

  • str (String) (defaults to: '')

Returns:

  • (String)


78
79
80
81
82
# File 'lib/axlsx/workbook/worksheet/sheet_protection.rb', line 78

def to_xml_string(str = '')
  str << '<sheetProtection '
  serialized_attributes str
  str << '/>'
end