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