NAME
Spreadsheet::XLSX::Reader::LibXML::CellToRowColumn - Translate Excel cell IDs to row column
DESCRIPTION
This is a fairly simple implementation of a regex and math to find the column and row position in excel from an 'A1' style Excel cell ID. 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 of this module is to count from 1 (the excel convention). Meaning that cell A1 is equal to (1, 1). However, there is a layer of abstraction in order to support count from zero settings using the Moose around function. See the Methods section for more details on the implementation.
SYNOPSIS
#!perl
package MyPackage;
use Moose;
with 'Spreadsheet::XLSX::Reader::LibXML::CellToColumnRow';
sub set_error{}
sub get_log_space{}
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( count_from_zero => 0 );
print '(' . join( ', ', $parser->my_method( 'B2' ) ) . ")'\n";
###########################
# SYNOPSIS Screen Output
# 01: (2, 2)
###########################
Methods
Methods are object methods (not functional methods)
parse_column_row( $excel_row_id, $count_from_one )
Definition: This is the way to turn an alpha numeric Excel cell ID into row and column integers. If count_from_zero = 1 but you want (column, row) pairs returned counting from 1 then set $count_from_one = 1. Or leave it blank to have the pair returned in the format defined by count_from_zero
Accepts: $excel_row_id, $count_from_one
Returns: ( $column_number, $row_number ) - integers
build_cell_label( $column, $row, $count_from_one )
Definition: This is the way to turn a (column, row) pair into an excel ID. If $count_from_one is set then the ($column, $row pair will be treated at counting from one independant of how count_from_zero is set. integers
Accepts: $column, $row, $count_from_one (in that order and position)
Returns: ( $excel_cell_id ) - integers
SUPPORT
TODO
1. Nothing yet
AUTHOR
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
Requires
get_log_space
set_error