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';
    
    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 use this module when writing your own excel parser. To use the general package for excel parsing out of the box please review the documentation for Workbooks, Worksheets, and Cells

This Moose Role is the primary tool for localization. It stores the number conversion format strings for the set region. In this particular case this module 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. When writing a drop in replacement for this module you should be able to just replace the strings in the '_defined_excel_translations' attribute and then set the "default_format_list" in Spreadsheet::XLSX::Reader::LibXML with your module when creating a new workbook parser. (Don't forget to rename the module!)

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.

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 currently with no changes

get_defined_excel_format( $integer )

total_defined_excel_formats

    Definition: This will return the count of all defined Excel format strings for this role. The primary value is to understand if the format string falls in the range of 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. (or other class instance consuming this role) For modification of these attributes see the listed 'attribute methods'. For more information on attributes see Moose::Manual::Attributes. Most of these attributes and methods are not exposed to the top level of Spreadsheet::XLSX::Reader::LibXML.

excel_region

    Definition: This records the target region of this localization role (Not the region of the Excel workbook being parsed)

    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 No Op)

    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, 2015 by Jed Lund

DEPENDENCIES

SEE ALSO