Skip to main content

ProtectionOptions

Struct ProtectionOptions 

Source
pub struct ProtectionOptions {
    pub password_hash: Option<String>,
    pub select_locked_cells: bool,
    pub select_unlocked_cells: bool,
    pub format_cells: bool,
    pub format_columns: bool,
    pub format_rows: bool,
    pub insert_columns: bool,
    pub insert_rows: bool,
    pub delete_columns: bool,
    pub delete_rows: bool,
    pub sort: bool,
    pub auto_filter: bool,
}
Expand description

Worksheet protection options

Fields§

§password_hash: Option<String>

Password hash (optional) - use set_password() to hash

§select_locked_cells: bool

Allow selecting locked cells (default: true)

§select_unlocked_cells: bool

Allow selecting unlocked cells (default: true)

§format_cells: bool

Allow formatting cells (default: false)

§format_columns: bool

Allow formatting columns (default: false)

§format_rows: bool

Allow formatting rows (default: false)

§insert_columns: bool

Allow inserting columns (default: false)

§insert_rows: bool

Allow inserting rows (default: false)

§delete_columns: bool

Allow deleting columns (default: false)

§delete_rows: bool

Allow deleting rows (default: false)

§sort: bool

Allow sorting (default: false)

§auto_filter: bool

Allow auto filter (default: false)

Implementations§

Source§

impl ProtectionOptions

Source

pub fn new() -> Self

Create new protection with default settings (most restrictive)

Source

pub fn with_password(self, password: &str) -> Self

Set password for protection (hashed with Excel’s algorithm)

Source

pub fn allow_select_locked_cells(self, allow: bool) -> Self

Allow users to select locked cells

Source

pub fn allow_select_unlocked_cells(self, allow: bool) -> Self

Allow users to select unlocked cells

Source

pub fn allow_format_cells(self, allow: bool) -> Self

Allow users to format cells

Source

pub fn allow_format_columns(self, allow: bool) -> Self

Allow users to format columns

Source

pub fn allow_format_rows(self, allow: bool) -> Self

Allow users to format rows

Source

pub fn allow_insert_columns(self, allow: bool) -> Self

Allow users to insert columns

Source

pub fn allow_insert_rows(self, allow: bool) -> Self

Allow users to insert rows

Source

pub fn allow_delete_columns(self, allow: bool) -> Self

Allow users to delete columns

Source

pub fn allow_delete_rows(self, allow: bool) -> Self

Allow users to delete rows

Source

pub fn allow_sort(self, allow: bool) -> Self

Allow users to sort

Source

pub fn allow_auto_filter(self, allow: bool) -> Self

Allow users to use auto filter

Trait Implementations§

Source§

impl Clone for ProtectionOptions

Source§

fn clone(&self) -> ProtectionOptions

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProtectionOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ProtectionOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.