NAME

Spreadsheet::XLSX::Reader::LibXML::FmtDefault - Default xlsx number formats and localization

SYNOPSIS

    #!/usr/bin/env perl
    package MyPackage;
    use Moose;
    with 'Spreadsheet::XLSX::Reader::LibXML::FmtDefault';
    
    sub get_log_space{}
    
    package main;
    
    my $parser = MyPackage->new;
    print '(' . join( ', ', $parser->get_defined_excel_format( 14 ) ) . ")\n";
	
	###########################
	# SYNOPSIS Screen Output
	# 01: (yyyy-m-d)
	###########################
    

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 Moose Role is the primary tool for localization. It stores the number conversion format strings for the set region. In this particular case it is the base english conversion set. It does rely on Spreadsheet::XLSX::Reader::LibXML::ParseExcelFormatStrings to build the actual coercions used to transform numbers for each string. However, the ParseExcelFormatStrings transformation should work for all regions strings.

The role also includes a string conversion function that is implemented after the data is extracted by libxml2 from the xml file. Specifically libxml2 attempts to determine the input encoding from the xml header and convert whatever format the file is in to unicode so the conversion out should be from unicode to your target_encoding. For now no encoding (output) conversion is actually provided and the function is essentially a pass-through of standard perl unicode.

To replace this module just build a Moose::Role that has the following Primary Methods and Attributes. Then set the default_format_list attribute with the new role name when initially starting Spreadsheet::XLSX::Reader::LibXML.

requires

These are method(s) used by this Role but not provided by the role. Any class consuming this role will not build without first providing 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.

Primary Methods

These are the primary ways to use this Role. For additional FmtDefault options see the Attributes section.

change_output_encoding( $string )

    Definition: Currently this is a placeholder that is always called by the Worksheet when a cell value is retreived in order to allow for future encoding adjustments on the way out. See "ENCODINGS SUPPORT IN XML::LIBXML" in XML::LibXML for an explanation of how the input encoding is handled. This conversion out is done prior to any number formatting. If you are replacing this role you need to have the function and you can use it to mangle your output string any way you want.

    Accepts: a unicode string

    Returns: the converted string

get_defined_excel_format( $integer )

    Definition: This will return the preset excel format string for the stored position. This role is used in the Styles class but this method is actually exposed all the way up to the Workbook class through Delegation.

    Accepts: an $integer for the format string position

    Returns: an excel format string

total_defined_excel_formats

    Definition: This will return the count of all defined Excel format strings for this localization. The primary value is to understand if the format string is a pre-set value or if the general .xlsx sheet reader should look in the Styles sheet for the format string.

    Accepts: nothing

    Returns: the total count of the pre-defined number coercion formats

get_defined_excel_format_list

    Definition: This will return the complete list of defined formats as an array ref

    Accepts: nothing

    Returns: an array ref of all pre-defined format strings

set_defined_excel_format_list

Attributes

Data passed to new when creating the Styles instance. For modification of these attributes see the listed 'attribute methods'. For more information on attributes see Moose::Manual::Attributes. Most of these are not exposed to the top level of Spreadsheet::XLSX::Reader::LibXML.

excel_region

    Definition: This records the target region of this localization role

    Default: en = english

    attribute methods Methods provided to adjust this attribute

      get_excel_region

        Definition: returns the value of the attribute (en)

target_encoding

    Definition: This is the target output encoding

    Default: UTF-8

    Range: No real options here (since it currently is a noop)

    attribute methods Methods provided to adjust this attribute

      set_target_encoding( $encoding )

        Definition: Changing this won't affect anything

      get_target_encoding

        Definition: Returns the currently set attribute value

SUPPORT

TODO

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