Commit | Line | Data |
d0eafc11 |
1 | package Excel::Template::Container::Worksheet; |
2 | |
3 | use strict; |
4 | |
5 | BEGIN { |
6 | use vars qw(@ISA); |
7 | @ISA = qw(Excel::Template::Container); |
8 | |
9 | use Excel::Template::Container; |
10 | } |
11 | |
8fd01531 |
12 | sub exit_scope { $_[1]->active_worksheet( undef ) } |
13 | |
d0eafc11 |
14 | sub 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 | |
33 | 1; |
34 | __END__ |
35 | |
36 | =head1 NAME |
37 | |
38 | Excel::Template::Container::Worksheet - Excel::Template::Container::Worksheet |
39 | |
40 | =head1 PURPOSE |
41 | |
42 | To provide a new worksheet. |
43 | |
44 | =head1 NODE NAME |
45 | |
46 | WORKSHEET |
47 | |
48 | =head1 INHERITANCE |
49 | |
50 | Excel::Template::Container |
51 | |
52 | =head1 ATTRIBUTES |
53 | |
54 | =over 4 |
55 | |
56 | =item * NAME |
57 | |
58 | This is the name of the worksheet to be added. |
59 | |
dba6a68e |
60 | =item * PROTECT |
61 | |
62 | If the attribute exists, it will mark the worksheet as being protected. Whatever |
63 | value is set will be used as the password. |
64 | |
65 | This activates the HIDDEN and LOCKED nodes. |
66 | |
d01e4722 |
67 | =item * KEEP_LEADING_ZEROS |
68 | |
69 | This will change the behavior of the worksheet to preserve leading zeros. |
70 | |
6dd4c89d |
71 | =back |
d0eafc11 |
72 | |
73 | =head1 CHILDREN |
74 | |
75 | None |
76 | |
77 | =head1 EFFECTS |
78 | |
79 | None |
80 | |
81 | =head1 DEPENDENCIES |
82 | |
83 | None |
84 | |
85 | =head1 USAGE |
86 | |
87 | <worksheet name="My Taxes"> |
88 | ... Children here |
89 | </worksheet> |
90 | |
91 | In the above example, the children will be executed in the context of the |
92 | "My Taxes" worksheet. |
93 | |
94 | =head1 AUTHOR |
95 | |
c09684ff |
96 | Rob Kinyon (rob.kinyon@gmail.com) |
d0eafc11 |
97 | |
98 | =head1 SEE ALSO |
99 | |
100 | ROW, CELL, FORMULA |
101 | |
102 | =cut |