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