Added more tests for conditionals. Need to fix linking in POD. - Intermediate commit!
[p5sagit/Excel-Template.git] / lib / Excel / Template / Container / Worksheet.pm
CommitLineData
d0eafc11 1package Excel::Template::Container::Worksheet;
2
3use strict;
4
5BEGIN {
6 use vars qw(@ISA);
7 @ISA = qw(Excel::Template::Container);
8
9 use Excel::Template::Container;
10}
11
8fd01531 12sub exit_scope { $_[1]->active_worksheet( undef ) }
13
d0eafc11 14sub render
15{
16 my $self = shift;
17 my ($context) = @_;
18
8fd01531 19 my $worksheet = $context->new_worksheet( $self );
d0eafc11 20
dba6a68e 21 my $password = $context->get( $self, 'PROTECT' );
22 if (defined $password)
23 {
8fd01531 24 $worksheet->protect( $password );
dba6a68e 25 }
26
8fd01531 27 $worksheet->keep_leading_zeros( 1 )
28 if $context->mark( 'keep_leading_zeros' );
d01e4722 29
d0eafc11 30 return $self->SUPER::render($context);
31}
32
331;
34__END__
35
36=head1 NAME
37
38Excel::Template::Container::Worksheet - Excel::Template::Container::Worksheet
39
40=head1 PURPOSE
41
42To provide a new worksheet.
43
44=head1 NODE NAME
45
46WORKSHEET
47
48=head1 INHERITANCE
49
50Excel::Template::Container
51
52=head1 ATTRIBUTES
53
54=over 4
55
56=item * NAME
57
58This is the name of the worksheet to be added.
59
dba6a68e 60=item * PROTECT
61
62If the attribute exists, it will mark the worksheet as being protected. Whatever
63value is set will be used as the password.
64
65This activates the HIDDEN and LOCKED nodes.
66
d01e4722 67=item * KEEP_LEADING_ZEROS
68
69This will change the behavior of the worksheet to preserve leading zeros.
70
6dd4c89d 71=back
d0eafc11 72
73=head1 CHILDREN
74
75None
76
77=head1 EFFECTS
78
79None
80
81=head1 DEPENDENCIES
82
83None
84
85=head1 USAGE
86
87 <worksheet name="My Taxes">
88 ... Children here
89 </worksheet>
90
91In the above example, the children will be executed in the context of the
92"My Taxes" worksheet.
93
94=head1 AUTHOR
95
c09684ff 96Rob Kinyon (rob.kinyon@gmail.com)
d0eafc11 97
98=head1 SEE ALSO
99
100ROW, CELL, FORMULA
101
102=cut