NAME
Spreadsheet::Reader::ExcelXML::ZipReader::WorkbookRels - Workbook Rels Zip file unique reader
SYNOPSIS
use Types::Standard qw( HashRef );
use MooseX::ShortCut::BuildInstance qw( build_instance );
use Types::Standard qw( HashRef );
use Data::Dumper;
my $workbook_instance = build_instance(
package => 'Spreadsheet::Reader::ExcelXML::Workbook',
add_attributes =>{
_rel_lookup =>{
isa => HashRef,
traits => ['Hash'],
handles =>{ get_rel_info => 'get', },
default => sub{ {
'rId2' => 'Sheet5',
'rId3' => 'Sheet1',
'rId1' => 'Sheet2'
} },
},
_sheet_lookup =>{
isa => HashRef,
traits => ['Hash'],
handles =>{ get_sheet_info => 'get', },
default => sub{ {
'Sheet1' => {
'sheet_id' => '1',
'sheet_position' => 2,
'sheet_name' => 'Sheet1',
'is_hidden' => 0,
'sheet_rel_id' => 'rId3'
},
'Sheet2' => {
'sheet_position' => 0,
'sheet_name' => 'Sheet2',
'sheet_id' => '2',
'sheet_rel_id' => 'rId1',
'is_hidden' => 0
},
'Sheet5' => {
'sheet_position' => 1,
'sheet_name' => 'Sheet5',
'sheet_id' => '3',
'sheet_rel_id' => 'rId2',
'is_hidden' => 1
}
} },
},
},
add_methods =>{
get_sheet_names => sub{ [
'Sheet2',
'Sheet5',
'Sheet1'
] },
}
);
my $rels_instance = build_instance(
superclasses => ['Spreadsheet::Reader::ExcelXML::XMLReader'],
package => 'WorkbookRelsInterface',
add_roles_in_sequence =>[
'Spreadsheet::Reader::ExcelXML::ZipReader::WorkbookRels',
'Spreadsheet::Reader::ExcelXML::WorkbookRelsInterface',
],
file => 'xl/_rels/workbook.xml.rels',
workbook_inst => $workbook_instance,
);
print Dumper( $rels_instance->get_worksheet_list );
###########################
# SYNOPSIS Screen Output
# 01: $VAR1 = [
# 02: 'Sheet2',
# 03: 'Sheet5',
# 04: 'Sheet1'
# 05: ]
###########################
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 is the Zip based file adaptor for reading the workbook rels data and then updating the general workbook metadata. The transformed data is then accesable through Methods . The goal is to standardize the outputs of this transformation metadata from non standard inputs.
Required Methods
These are the methods required by the role. A link to the default implementation of these methods is provided.
"get_sheet_info( $name )" in Spreadsheet::Reader::ExcelXML
"get_rel_info( $rel_id )" in Spreadsheet::Reader::ExcelXML
"get_sheet_names" in Spreadsheet::Reader::ExcelXML
"advance_element_position( $element, [$iterations] )" in Spreadsheet::Reader::ExcelXML::XMLReader
"current_node_parsed" in Spreadsheet::Reader::ExcelXML::XMLReader
"parse_element( [$depth] )" in Spreadsheet::Reader::ExcelXML::XMLReader
"squash_node( $node )" in Spreadsheet::Reader::ExcelXML::XMLReader
"good_load( $state )" in Spreadsheet::Reader::ExcelXML::XMLReader
Methods
These are the methods provided by this role (only).
load_unique_bits
Definition: This role is meant to run on top of Spreadsheet::Reader::ExcelXML::XMLReader. When it does the reader will call this function as available when it first starts the file. Therefore this is where the unique Metadata for this file is found and stored. (in the attributes)
Accepts: nothing
Returns: nothing
get_sheet_lookup
Definition: The sheet lookup is a hashref with keys as sheet names and the values are a sub hashref with $key => $value pairs of sheet meta data containing information like hiddeness and location. This method returns the full set.
Accepts: nothing
Returns: a full hashref of hashrefs
get_worksheet_list
Definition: returns an ordered arrayref conataining only worksheet names in their visible order from the Excel workbook.
Accepts: nothing
Returns: an arrayref of names
get_chartsheet_list
Definition: returns an ordered arrayref conataining only chartsheet names in their visible order from the Excel workbook.
Accepts: nothing
Returns: an arrayref of names
SUPPORT
TODO
1. Nothing currently
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) 2016 by Jed Lund
DEPENDENCIES
Spreadsheet::Reader::ExcelXML - the package
SEE ALSO
Spreadsheet::Read - generic Spreadsheet reader
Spreadsheet::ParseExcel - Excel binary version 2003 and earlier (.xls files)
Spreadsheet::XLSX - Excel version 2007 and later
Spreadsheet::ParseXLSX - Excel version 2007 and later
All lines in this package that use Log::Shiras are commented out