NAME

Spreadsheet::XLSX::Reader::LibXML::CellToColumnRow - Translate Excel cell IDs to column row

SYNOPSIS

	#!/usr/bin/env perl
	package MyPackage;
	use Moose;
	with 'Spreadsheet::XLSX::Reader::LibXML::CellToColumnRow';

	sub set_error{} #Required method of this role
	sub get_log_space{} #Required method of this role
		
	sub my_method{
		my ( $self, $cell ) = @_;
		my ($column, $row ) = $self->parse_column_row( $cell );
		print $self->error if( !defined $column or !defined $row );
		return ($column, $row );
	}

	package main;

	my $parser = MyPackage->new;
	print '(' . join( ', ', $parser->my_method( 'B2' ) ) . ")'\n";
	
	###########################
	# SYNOPSIS Screen Output
	# 01: (2, 2)
	###########################
    

DESCRIPTION

This documentation is written to explain ways to extend this package. To use the data extraction of Excel workbooks, worksheets, and cells please review the documentation for Spreadsheet::XLSX::Reader::LibXML, Spreadsheet::XLSX::Reader::LibXML::Worksheet, and Spreadsheet::XLSX::Reader::LibXML::Cell

This is a Moose Role. The role provides methods to convert back and forth betwee Excel Cell ID and column row numbers. The role also provides a layer of abstraction so that it is possible to implement around on these methods so that the data provided by the user can be in the user context and the method implementation will still be in the Excel context. For example this package uses this abstraction to allow the user to call or receive row column numbers in either the count from zero context used by Spreadsheet::ParseExcel or the count from one context used by Excel. It is important to note that column letters do not equal digits in a modern 26 position numeral system since the excel implementation is effectivly zeroless.

The default for this module is to count from 1 (the excel convention). Meaning that cell ID 'A1' is equal to (1, 1) and column row (3, 2) is equal to the cell ID 'C2'.

requires

These are methods used by this Role but not provided by the role. Any class consuming this role will not build unless it first provides these methods prior to loading this role.

get_log_space

    Definition: Used to return the log space used by the code protected by ###LogSD. See Log::Shiras for more information.

set_error( $error_string )

Methods

Methods are object methods (not functional methods)

parse_column_row( $excel_cell_id )

    Definition: This is the way to turn an alpha numeric Excel cell ID into column and row integers. This method uses a count from 1 methodology. Since this method is actually just a layer of abstraction above the real method for the calculation you can wrap it in an around block to modify the output to the desired user format without affecting other parts of the package that need the unfiltered conversion. If you want both then use the following call when unfiltered results are required;

    $self->_parse_column_row( $excel_cell_id )

    Accepts: $excel_cell_id

    Returns: ( $column_number, $row_number ) - integers

build_cell_label( $column, $row, )

    Definition: This is the way to turn a (column, row) pair into an Excel Cell ID. The underlying method uses a count from 1 methodology. Since this method is actually just a layer of abstraction above the real method for the calculation you can wrap it in an around block to modify the input from the implemented user format to the count from one methodology without affecting other parts of the package that need the unfiltered conversion. If you want both then use the following call when unfiltered results are required;

    $self->_build_cell_label( $column, $row )

    The column and the row must be provided in that order for both public and private methods.

    Accepts: $column, $row, $count_from_one (in that order and position)

    Returns: ( $excel_cell_id ) - qr/[A-Z]{1,3}\d+/

SUPPORT

TODO

    1. Nothing yet

AUTHOR

Jed Lund
jandrew@cpan.org

COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

This software is copyrighted (c) 2014 by Jed Lund

DEPENDENCIES

SEE ALSO