File: Row.pm

package info (click to toggle)
libexcel-template-perl 0.34-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 608 kB
  • sloc: perl: 3,471; xml: 210; makefile: 2
file content (101 lines) | stat: -rw-r--r-- 1,422 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package Excel::Template::Container::Row;

use strict;

BEGIN {
    use vars qw(@ISA);
    @ISA = qw(Excel::Template::Container);

    use Excel::Template::Container;
}

sub render
{
    my $self = shift;
    my ($context) = @_;

    $context->{COL} = 0;

    # Apply the height to the current row
    if (my $height = $context->get($self, 'HEIGHT'))
    {
        $height =~ s/\D//g;
        $height *= 1;
        if ($height > 0)
        {
            $context->active_worksheet->set_row(
                $context->get( $self, 'ROW' ),
                $height,
            );
        }
    }

    return $self->SUPER::render($context);
}

sub deltas
{
    return {
        ROW => +1,
    };
}

1;
__END__

=head1 NAME

Excel::Template::Container::Row - Excel::Template::Container::Row

=head1 PURPOSE

To provide a row context for CELL tags

=head1 NODE NAME

ROW

=head1 INHERITANCE

Excel::Template::Container

=head1 ATTRIBUTES

=over 4

=item * HEIGHT

Sets the height of the row. The last setting for a given row will win out.

=back

=head1 CHILDREN

None

=head1 EFFECTS

Each ROW tag will consume one row of the workbook. When the ROW tag starts, it
will set the COL value to 0.

=head1 DEPENDENCIES

None

=head1 USAGE

  <row>
    ... Children here
  </row>

Generally, you will have CELL and/or FORMULA tags within a ROW.

=head1 AUTHOR

Rob Kinyon (rob.kinyon@gmail.com)

=head1 SEE ALSO

CELL, FORMULA

=cut