NAME
Spreadsheet::XLSX::Reader::LibXML::Cell - A class for Cell data and formatting
SYNOPSIS
See the SYNOPSIS in Spreadsheet::XLSX::Reader::LibXML
DESCRIPTION
This is the class that contains cell data. There are no XML actions taken in the background of this class. All data has been pre-coalated/built from the Workbook class. See the Workbook class for creation of this class. Accessing the data is done through the Methods.
Attributes
Attributes of this cell are not included in the documentation because 'new' should be called by other classes in this package.
Methods
These are ways to access the data and formats in the cell. They also provide a way to modifiy the output of the format.
unformatted
Definition: Returns the unformatted value of the cell in whatever encoding it was stored in.
Accepts:Nothing
Returns: the unformatted (raw) cell value in whatever encoding it was stored in
value
Definition: Returns the formatted value of the cell. Excel really only tries to manipulate numbers. If the sheet has some pre-defined number manipulation this will attempt to implement it prior to returning the value. If there is no format set then this will return $cell->unformatted.For adjustment of the conversion method see set_format. Any failures to process this value can be retrieved $self->error.
Accepts:Nothing
Returns: the cell value processed by the set format
encoding
Definition: the libxml2 library will attempt to convert everything into UTF-8 so the output from unformatted should be in UTF-8. However, for strings the encoding of the strings (sub)file sharedStrings.xml may be stored in a different encoding. This method returns the registered encoding of the sharedStrings.xml (sub)file.
Accepts: Nothing
Returns: the 'encoding' attribute of the sharedStrings.xml (sub)file
type
Definition: Excel 2007 and newer only recognizes two types of data, strings or numbers. All additional formating or other manipulation is done when the data is presented through the format layer. This method identifies how the data in this cell was stored specifically as it is in XML. For more information on the format applied see set_format
Accepts: Nothing
Returns: (s|number) s = string
column
Definition: This method returns the column number of the cell counting either from zero or from one depending on the setting from the initial parser build. To check the setting see counting_from_zero..
Accepts: Nothing
Returns: cell column number
row
Definition: This method returns the row number of the cell counting either from zero or from one depending on the setting from the initial parser build. To check the setting see counting_from_zero..
Accepts: Nothing
Returns: cell row number
formula
Definition: For cells calculated from a formula they will have both the formula used to create the end result and the most recent calculated result. This method returns the formula string from Excel used to obtain the result. To see the most recent calculated result see value or unformatted ..
Accepts: Nothing
Returns: the formula used in the excel spreadsheet to calculate the cell value.
has_formula
Definition: This will indicate if the cell has a formula associated with it..
Accepts: Nothing
Returns: the formula used in the excel spreadsheet to calculate the cell value.
get_merge_range
Definition: Any cell that is merged with another cell will have a merge range. in excel. Only the top left cell will actually contain the value of the merged cell. This follows the excel precedent.
Accepts: (undef|array)
Returns: If the method is called with no arguments then the merge range is provided in the format. "A1:D3". If the value 'array' (and only array) is passed then the range is returned as an array ref in the format [[$start_column, $start_row], [$end_column,$end_row] ]
is_merged
Definition: This method returns a boolean value that indicates if this cell has been merged with other cells.
Accepts: Nothing
Returns: $bool
get_rich_text
Definition: This method returns a rich text data structure like the same method in Spreadsheet::ParseExcel::Cell with the exception that it doesn't bless each hashref into an object. The hashref's are also organized per the Excel xlsx information the the sharedStrings.xml file. In general this is an arrayref of arrayrefs where the second level contains two positions. The first position is the place (from zero) where the formatting is implemented. The second position is a hashref of the formatting values.
note: It is important to understand that Excel can store two formats for the same cell and often they don't agree. For example using the get_font method in class will not always yield the same value as get_rich_text.
Accepts: Nothing
Returns: an arrayref of rich text data
has_rich_text
Definition: This method returns a boolean value that indicates if this cell has rich text data.
Accepts: Nothing
Returns: $bool
get_font
Definition: This method returns the font assigned to this cell.
Accepts: Nothing
Returns: $font
get_fill
Definition: This method returns the fill assigned to this cell.
Accepts: Nothing
Returns: $fill
get_border
Definition: This method returns the border assigned to this cell.
Accepts: Nothing
Returns: $border
get_alignment
Definition: This method returns the alignment assigned to this cell.
Accepts: Nothing
Returns: $alignment
set_format
Definition: To set a format object it must pass two criteria. The ref must have the method 'coerce' and it must have the method 'display_name'. This is the object that will be used to convert the unformatted value. For another way to apply formats to the cell see the Spreadsheet::XLSX::Reader::Worksheet 'custom_formats' attribute.
Accepts: a ref that can 'coerce' and can 'display_name'
Returns: Nothing
get_format
Definition: When excel talks about 'format' it is closer to the perl function sprintf. This returns the object used to turn the unformatted value into a formatted value.
Accepts: Nothing
Returns: Object instance that can 'coerce'
has_format
Definition: This method returns a boolean value that indicates if this cell has an assigned format.
Accepts: Nothing
Returns: $bool
clear_format
Definition: This method clears any format set for the cell. After this action the value function will return the equvalent of unformatted
Accepts: Nothing
Returns: $bool
format_name
Definition: This method calls ->display_name on the format instance.
Accepts: Nothing
Returns: $display_name
error
Definition: This method gets the latest stored string from the error in Spreadsheet::XLSX::Reader::LibXML::Error I could change in the future but currently the error instance is shared across all instances of the Spreadsheet::XLSX::Reader::LibXML classes that have been created.
Accepts: Nothing
Returns: $error_string
set_error( $string )
Definition: This method sets a new error $string to the Spreadsheet::XLSX::Reader::LibXML::Error instance.
Accepts: An error string $string
Returns: Nothing
clear_error
Definition: This method clears the error $string in the Spreadsheet::XLSX::Reader::LibXML::Error instance.
Accepts: Nothing
Returns: Nothing
set_warnings( $bool )
Definition: When the error string is set / changed for the Spreadsheet::XLSX::Reader::LibXML::Error instance the instance can cluck/warn the message at that time based on this setting.
Accepts: A $boolean value
Returns: Nothing
if_warn
Definition: This is the predicate for the set_warnings setting. It will show whether warnings are turned on or off.
Accepts: Nothing
Returns: A $boolean value
is_not_empty
Definition: This is a predicate method to tell if the cell has an unformatted value
Accepts: Nothing
Returns: a boolean value to indicate if the cell is empty or not
cell_id
Definition: This returns the excel alphanumeric identifier for the cell location.
Accepts: Nothing
Returns: cell position ex. B15
get_log_space
Definition: This returns the stored log space for this module
Accepts: Nothing
Returns: $log_space_string
set_log_space
Definition: This changes the stored log space for this module
Accepts: $log_space_string
Returns: Nothing
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
5.010 - (perl)