Excel::Template::Element::Backref - Excel::Template::Element::Backref documentation


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

Index


Code Index:

NAME

Top

Excel::Template::Element::Backref

PURPOSE

Top

Returns the cell location (i.e. B2) of the last cell to name this reference. To return the location of the entire range of cells to name this reference see RANGE.

NODE NAME

Top

BACKREF

INHERITANCE

Top

Excel::Template::Element

ATTRIBUTES

Top

* REF

This is the name of the reference to look up.

CHILDREN

Top

None

EFFECTS

Top

None

DEPENDENCIES

Top

This will only be used within CELL tags.

USAGE

Top

In the example...

  <row>
    <cell ref="this_cell"/><cell ref="that_cell"><cell ref="that_cell">
  </row>
  <row>
    <formula>=<backref ref="this_cell">+<backref ref="that_cell"></formula>
  </row>

The formula in row 2 would be =A1+C1. C1 is the last to reference "that_cell".

AUTHOR

Top

Rob Kinyon (rkinyon@columbus.rr.com)

SEE ALSO

Top

CELL, RANGE


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

package Excel::Template::Element::Backref;

use strict;
use Spreadsheet::WriteExcel::Utility;

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

    use Excel::Template::Element;
}

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

    my $ref_name = $context->resolve($self, 'REF');

    my ($row, $col) = $context->get_last_reference( $ref_name );
    return '' unless defined $row && defined $col;

    return xl_rowcol_to_cell( $row, $col );
}

1;
__END__