NAME

Spreadsheet::Reader::ExcelXML::PositionStyles - Position based styles reader

SYNOPSYS

!!!! Example code - will not run standalone !!!!

use MooseX::ShortCut::BuildInstance qw( build_instance );
use Spreadsheet::Reader::ExcelXML::XMLReader::PositionStyles;
use Spreadsheet::Reader::ExcelXML::XMLReader;
my	$test_instance	=	build_instance(
		package => 'StylesInterface',
		superclasses => ['Spreadsheet::Reader::ExcelXML::XMLReader'],
		add_roles_in_sequence => [
			'Spreadsheet::Reader::ExcelXML::XMLReader::PositionStyles',
		],
		file => 'styles.xml',
		workbook_inst => $workbook_instance,<--- Built elswhere!!!
	);

DESCRIPTION

This role is written to provide the methods 'get_format' and 'get_default_format' for the styles file reading where the styles file elements are called out by position. The usually occurs in the case where and .xlsx file (zipped format) is provided.

Requires

These are the methods required by this role and their default provider. All methods are imported straight across with no re-naming.

Method(s)

These are the methods provided by this role.

get_format( $position, [$header], [$exclude_header] )

    Definition: This will return the styles information from the identified $position (counting from zero). The target position is usually drawn from the cell data stored in the worksheet. The information is returned as a perl hash ref. Since the styles data is in two tiers it finds all the subtier information for each indicated piece and appends them to the hash ref as values for each type key.

    Accepts position 0: $position = an integer for the styles $position.

    Accepts position 1: $header = the target header key (use the "Attributes" in Spreadsheet::Reader::ExcelXML::Cell that are cell formats as the definition of range for this.) It will cause only this header subset to be returned

    Accepts position 2: $exclude_header = the target header key (use the "Attributes" in Spreadsheet::Reader::ExcelXML::Cell that are cell formats as the definition of range for this.) It will exclude the header from the returned data set.

    Returns: a hash ref of data

get_default_format( [$header], [$exclude_header] )

    Definition: For any cell that does not have a unquely identified format excel generally stores a default format for the remainder of the sheet. This will return the two tiered default styles information. The information is returned in the same format as the get_format method.

    Accepts position 0: $header = the target header key (use the "Attributes" in Spreadsheet::Reader::ExcelXML::Cell that are cell formats as the definition of range for this.) It will cause only this header subset to be returned

    Accepts position 1: $exclude_header = the target header key (optional at position 2) (use the "Attributes" in Spreadsheet::Reader::ExcelXML::Cell that are cell formats as the definition of range for this.) It will exclude the header from the returned data set.

    Returns: a hash ref of data

load_unique_bits

    Definition: When the xml file first loads this is available to pull customized data. It mostly pulls metadata and stores it in hidden attributes for use later. If all goes according to plan it sets "good_load" in Spreadsheet::Reader::ExcelXML::XMLReader to 1.

    Accepts: Nothing

    Returns: Nothing

Attributes

Data passed to new when creating an instance with this role. For modification of this(ese) attribute(s) see the listed 'attribute methods'. For more information on attributes see Moose::Manual::Attributes. The easiest way to modify this(ese) attribute(s) is during instance creation before it is passed to the workbook or parser.

cache_positions

    Definition: Especially for sheets with lots of stored formats the parser can slow way down when accessing each postion. This is because the are not stored sequentially and the reader is a JIT linear parser. To go back it must restart and index through each position till it gets to the right place. This is especially true for excel sheets that have experienced any significant level of manual intervention prior to being read. This attribute sets caching (default on) for styles so the parser builds and stores all the styles settings at the beginning. If the file is cached it will close and release the file handle in order to free up some space. (a small win in exchange for the space taken by the cache).

    Default: 1 = caching is on

    Range: 1|0

    Attribute required: yes

    attribute methods Methods provided to adjust this attribute

SUPPORT

TODO

    1. Nothing yet

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) 2016 by Jed Lund

DEPENDENCIES

SEE ALSO