Spreadsheet-WriteExcel-Worksheet-SheetProtection
view release on metacpan or search on metacpan
SheetProtection.pm view on Meta::CPAN
package Spreadsheet::WriteExcel::Worksheet::SheetProtection;
use 5.005;
use strict;
use vars '$VERSION';
$VERSION = '0.03';
BEGIN {
use Spreadsheet::WriteExcel::Worksheet;
no strict 'refs';
## HACK ALERT!
## Add a _store_eof method to Spreadsheet::WriteExcel::Worksheet to be able to
## add the SHEETPROTECTION record when streaming out file
*{"Spreadsheet::WriteExcel::Worksheet::_store_eof"} = sub {
_store_sheet_protection(@_);
Spreadsheet::WriteExcel::BIFFwriter::_store_eof(@_);
} ;
## Add sheet_protection method
*{"Spreadsheet::WriteExcel::Worksheet::sheet_protection"} = \&sheet_protection;
}
=head1 NAME
Spreadsheet::WriteExcel::Worksheet::SheetProtection - Sheet Protection extension
for Spreadsheet::WriteExcel::Worksheet
=head1 SYNOPSIS
use Spreadsheet::WriteExcel;
use Spreadsheet::WriteExcel::Worksheet::SheetProtection;
my $workbook = new Spreadsheet::WriteExcel("file.xls");
my $worksheet = $workbook->add_worksheet;
...
# Protect workseet
$worksheet->protect;
## Specify protection settings
## Disallow selection of locked cells but allow column formatting
$worksheet->sheet_protection(
-select_locked_cells => 0,
-format_columns => 1 );
=head1 DESCRIPTION
This module allows you to specify the sheet protection attribute available in recent
versions of Microsoft Excel (Menu item: Tools > Protection > Protect Sheet...).
It extends the L<Spreadsheet::WriteExcel::Worksheet> class by adding a
C<sheet_protection> method which you use to specify the protection attributes.
=head2 Protection Flags
The following flags can be set (or cleared) to specify which aspects of a
worksheet are protected.
SelectLockedCells (Default set)
SelectUnlockedCells (Default set)
FormatCells
FormatColumns
FormatRows
InsertColumns
InsertRows
InsertHyperlinks
DeleteColumns
DeleteRows
( run in 0.463 second using v1.01-cache-2.11-cpan-0fb53d1c279 )