NAME

Spreadsheet::XLSX::Reader::LibXML::Cell - XLSX Cell data and formatting source

SYNOPSIS

See the SYNOPSIS in the Workbook class

DESCRIPTION

This is the class that contains cell data. There are no XML parsing actions taken in the background of this class. All data has been pre-coalated/built from the Worksheet class. In general the Worksheet class will populate the attributes of this class when it is generated. If you want to use it as a standalone class just fill in the Attributes below.

This class uses a role for full functional implementation. Read the documentation for each of the role as well as this documentation to gain a complete picture of this class.

with

These are attached role(s) for additional (re-used) functionality

Spreadsheet::XLSX::Reader::LibXML::LogSpace

Primary Methods

These are methods used to transform data stored in the Attributes (not just return it directly).

unformatted

    Definition: Returns the unformatted value of the cell transformed with the change_output_encoding method.

    Accepts:Nothing

    Returns: the cell value processed by the encoding conversion

has_unformatted

    Definition: This is a predicate method to determine if the cell had any value stored in it. Sometimes this class will be generated by the Worksheet class when there is cell formatting but no value. Ex. Merged cells store the value in the left upper corner of the merged area but have cell specific formatting for all cells in the merge area.

    Accepts:Nothing

    Returns: True if the cell holds a value

value

    Definition: Returns the formatted value of the cell transformed from the unformatted string. This method uses the conversion stored in the cell_coercion attribute. If there is no format/conversion set then this will return the unformatted value. Any failures to process this value can be retrieved with $self->error.

    Accepts:Nothing

    Returns: the cell value processed by the set conversion

Attributes

This class is just a storage of coallated information about the requested cell stored in the following attributes. For more information on attributes see Moose::Manual::Attributes.

error_inst

    Definition: This attribute holds an 'error' object instance. It should have several methods for managing errors. Currently no error codes or error translation options are available but this should make implementation of that easier. In general the package shares a reference for this instance accross the workbook all worksheets and all cells so any set or get action should return the latest state from anywhere.

    Default: a Spreadsheet::XLSX::Reader::LibXML::Error instance with the attributes set as;

    ( should_warn => 0 )

    Range: The minimum list of methods to implement for your own instance is;

    error set_error clear_error set_warnings if_warn

    attribute methods Methods provided to adjust this attribute

      get_error_inst

        Definition: returns this instance

      error

        Definition: Used to get the most recently logged error

      set_error

        Definition: used to set a new error string

      clear_error

        Definition: used to clear the current error string in this attribute

      set_warnings

        Definition: used to turn on or off real time warnings when errors are set

      if_warn

        Definition: a method mostly used to extend this package and see if warnings should be emitted.

cell_unformatted

    Definition: This holds the unformatted value of the cell (if any)

    Default: undef

    Range: a string

    attribute methods Methods provided to adjust this attribute

      has_unformatted

        Definition: a predicate method to determine if any value is in the cell

rich_text

    Definition: This attribute hold a rich text data structure like "get_rich_text()" 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 specific fonts in the rich text array.

    Default: undef = no rich text defined for this cell

    Range: an array ref of rich_text positions and definitions

    attribute methods Methods provided to adjust this attribute

      get_rich_text

        Definition: returns the attribute value

      has_rich_text

        Definition: Indicates if the attribute has anything stored

cell_font

    Definition: This holds the font assigned to the cell

    Default: undef

    Range: a hashref of font definitions

    attribute methods Methods provided to adjust this attribute

      get_font

        Definition: returns the attribute value

      has_font

        Definition: Indicates if the attribute has anything stored

cell_border

    Definition: This holds the border settings assigned to the cell

    Default: undef

    Range: a hashref of border definitions

    attribute methods Methods provided to adjust this attribute

      get_border

        Definition: returns the attribute value

      has_border

        Definition: Indicates if the attribute has anything stored

cell_style

    Definition: This holds the border settings assigned to the cell

    Default: undef

    Range: a hashref of style definitions

    attribute methods Methods provided to adjust this attribute

      get_style

        Definition: returns the attribute value

      has_style

        Definition: Indicates if the attribute has anything stored

cell_fill

    Definition: This holds the fill settings assigned to the cell

    Default: undef

    Range: a hashref of style definitions

    attribute methods Methods provided to adjust this attribute

      get_fill

        Definition: returns the attribute value

      has_fill

        Definition: Indicates if the attribute has anything stored

cell_type

    Definition: This holds the type of data stored in the cell. In general it follows the convention of Spreadsheet::ParseExcel however, since custom coercions will change data to some possible non excel standard state this also includes a 'Custom' type representing any value with a custom conversion assigned.

    Default: Text

    Range: Text = Strings, Numeric = Real Numbers, Date = Real Numbers with an assigned Date conversion, Custom = any stored value with a custom conversion

    attribute methods Methods provided to adjust this attribute

      type

        Definition: returns the attribute value

      has_type

        Definition: Indicates if the attribute has anything stored (Always true)

cell_encoding

    Definition: This holds the byte encodeing of the data stored in the cell

    Default: Unicode

    Range: Traditional encoding options

    attribute methods Methods provided to adjust this attribute

      encoding

        Definition: returns the attribute value

      has_encoding

        Definition: Indicates if the attribute has anything stored

cell_merge

    Definition: if the cell is part of a group of merged cells this will store the upper left and lower right cell ID's in a string concatenated with a :

    Default: undef

    Range: two cell ID's

    attribute methods Methods provided to adjust this attribute

      merge_range

        Definition: returns the attribute value

      is_merged

        Definition: Indicates if the attribute has anything stored

cell_formula

    Definition: if the cell value (unformatted) is calculated based on a formula the Excel formula string is stored in this attribute.

    Default: undef

    Range: Excel formula string

    attribute methods Methods provided to adjust this attribute

      formula

        Definition: returns the attribute value

      has_formula

        Definition: Indicates if the attribute has anything stored

cell_row

    Definition: This is the sheet row that the cell was read from

    Range: the minimum row to the maximum row

    attribute methods Methods provided to adjust this attribute

      row

        Definition: returns the attribute value

      has_row

        Definition: Indicates if the attribute has anything stored

cell_col

    Definition: This is the sheet column that the cell was read from

    Range: the minimum column to the maximum column

    attribute methods Methods provided to adjust this attribute

      col

        Definition: returns the attribute value

      has_col

        Definition: Indicates if the attribute has anything stored

r

    Definition: This is the sheet ID of the cell

    attribute methods Methods provided to adjust this attribute

      cell_id

        Definition: returns the attribute value

      has_cell_id

        Definition: Indicates if the attribute has anything stored

    Definition: This stores any hyperlink from the cell

    attribute methods Methods provided to adjust this attribute

      get_hyperlink

        Definition: returns the attribute value

      has_hyperlink

        Definition: Indicates if the attribute has anything stored

cell_coercion

    Definition: This attribute holds the tranformation code to turn an unformatted value into a formatted value.

    Default: a Type::Tiny instance with sub types set to assign different inbound data types to different coercions for the target outcome of formatted data.

    Range: If you wish to set this with your own code it must have two methods. First, 'assert_coerce' which will be applied when transforming the unformatted value. Second, 'display_name' which will be used to self identify.

    attribute methods Methods provided to adjust this attribute

      get_coercion

        Definition: returns this instance

      clear_coercion

        Definition: used to clear the this attribute

      set_coercion

        Definition: used to set a new coercion instance

      has_coercion

        Definition: Indicate if any coecion code is applied

      coercion_name

        Definition: calls 'display_name' on the code in the background

SUPPORT

TODO

    1. Return the merge range in array and hash formats

    2. Add calc chain values

    3. Have unformatted return '' (the empty string) rather than undef for null?

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

DEPENDENCIES

SEE ALSO