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


Excel-Template documentation Contained in the Excel-Template distribution.

Index


Code Index:

NAME

Top

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

PURPOSE

Top

To provide a row context for CELL tags

NODE NAME

Top

ROW

INHERITANCE

Top

Excel::Template::Container

ATTRIBUTES

Top

* HEIGHT

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

CHILDREN

Top

None

EFFECTS

Top

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

DEPENDENCIES

Top

None

USAGE

Top

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

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

AUTHOR

Top

Rob Kinyon (rob.kinyon@gmail.com)

SEE ALSO

Top

CELL, FORMULA


Excel-Template documentation Contained in the Excel-Template distribution.

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__