b3067e68ec382d6db258b6fc0fab3493ad673705
[p5sagit/Excel-Template.git] / lib / Excel / Template / Container / Row.pm
1 package Excel::Template::Container::Row;
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
17     $context->{COL} = 0;
18
19     # Apply the height to the current row
20     if (my $height = $context->get($self, 'HEIGHT'))
21     {
22         $height =~ s/\D//g;
23         $height *= 1;
24         if ($height > 0)
25         {
26             $context->active_worksheet->set_row(
27                 $context->get( $self, 'ROW' ),
28                 $height,
29             );
30         }
31     }
32
33     return $self->SUPER::render($context);
34 }
35
36 sub deltas
37 {
38     return {
39         ROW => +1,
40     };
41 }
42
43 1;
44 __END__
45
46 =head1 NAME
47
48 Excel::Template::Container::Row - Excel::Template::Container::Row
49
50 =head1 PURPOSE
51
52 To provide a row context for CELL tags
53
54 =head1 NODE NAME
55
56 ROW
57
58 =head1 INHERITANCE
59
60 Excel::Template::Container
61
62 =head1 ATTRIBUTES
63
64 =over 4
65
66 =item * HEIGHT
67
68 Sets the height of the row. The last setting for a given row will win out.
69
70 =back
71
72 =head1 CHILDREN
73
74 None
75
76 =head1 EFFECTS
77
78 Each ROW tag will consume one row of the workbook. When the ROW tag starts, it
79 will set the COL value to 0.
80
81 =head1 DEPENDENCIES
82
83 None
84
85 =head1 USAGE
86
87   <row>
88     ... Children here
89   </row>
90
91 Generally, you will have CELL and/or FORMULA tags within a ROW.
92
93 =head1 AUTHOR
94
95 Rob Kinyon (rob.kinyon@gmail.com)
96
97 =head1 SEE ALSO
98
99 CELL, FORMULA
100
101 =cut