1 package Excel::Template::Container::Worksheet;
7 @ISA = qw(Excel::Template::Container);
9 use Excel::Template::Container;
12 sub exit_scope { $_[1]->active_worksheet(undef) }
18 my $worksheet = $context->new_worksheet($self);
20 my $password = $context->get( $self, 'PROTECT' );
21 if ( defined $password ) {
22 $worksheet->protect($password);
25 $worksheet->keep_leading_zeros(1)
26 if $context->mark('keep_leading_zeros');
28 if ( $context->get( $self, 'LANDSCAPE' ) && !$self->{PORTRAIT} ) {
29 $worksheet->set_landscape;
30 } elsif ( $context->get( $self, 'PORTRAIT' ) ) {
31 $worksheet->set_portrait;
35 my $hide_gridlines = $context->get( $self, 'HIDE_GRIDLINES');
37 if ( defined $hide_gridlines ) {
38 $worksheet->hide_gridlines( $hide_gridlines );
41 return $self->SUPER::render($context);
49 Excel::Template::Container::Worksheet - Excel::Template::Container::Worksheet
53 To provide a new worksheet.
61 Excel::Template::Container
69 This is the name of the worksheet to be added.
73 If the attribute exists, it will mark the worksheet as being protected. Whatever
74 value is set will be used as the password.
76 This activates the HIDDEN and LOCKED nodes.
78 =item * KEEP_LEADING_ZEROS
80 This will change the behavior of the worksheet to preserve leading zeros.
85 his method is used to hide the gridlines on the screen and printed page.
86 Gridlines are the lines that divide the cells on a worksheet. Screen and printed gridlines are
87 turned on by default in an Excel worksheet. If you have defined your own cell
88 borders you may wish to hide the default gridlines.
90 $worksheet->hide_gridlines();
92 The following values of $option are valid:
94 0 : Don't hide gridlines
95 1 : Hide printed gridlines only
96 2 : Hide screen and printed gridlines
98 If you don't supply an argument or use undef the default option is 1, i.e. only the printed gridlines are hidden.
102 This will set the worksheet's orientation to landscape.
106 This will set the worksheet's orientation to portrait.
108 While this is the default, it's useful to override the default at times. For
109 example, in the following situation:
111 <workbook landscape="1">
115 <worksheet portrait="1">
123 In that example, the first and third worksheets will be landscape (inheriting
124 it from the workbook node), but the second worksheet will be portrait.
142 <worksheet name="My Taxes">
146 In the above example, the children will be executed in the context of the
147 "My Taxes" worksheet.
151 Rob Kinyon (rob.kinyon@gmail.com)