Spreadsheet::Reader::ExcelXML::XMLReader::WorkbookRels - Workbook Rels XML file unique reader
use Types::Standard qw( HashRef ); use MooseX::ShortCut::BuildInstance qw( build_instance ); 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 $file_handle = File::Temp->new(); print $file_handle '<?xml version="1.0"?><NO_FILE/>';# The rels meta data is inferred, not parsed my $rels_instance = build_instance( superclasses => ['Spreadsheet::Reader::ExcelXML::XMLReader'], package => 'WorkbookRelsInterface', add_roles_in_sequence =>[ 'Spreadsheet::Reader::ExcelXML::XMLReader::WorkbookRels', 'Spreadsheet::Reader::ExcelXML::WorkbookRelsInterface', ], file => $file_handle, workbook_inst => $workbook_instance, ); print Dumper( $rels_instance->get_worksheet_list ); ########################### # SYNOPSIS Screen Output # 01: $VAR1 = [ # 02: 'Sheet2', # 03: 'Sheet5', # 04: 'Sheet1' # 05: ] ###########################
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 XML based file adaptor for reading the workbook rels data and then updating the general workbook metadata. All the rels data for flat xml files is inferred so the primary function is to transform the previously stored meta data for the rels stage. The transformed data is then accesable through Methods. The goal is to standardize the outputs of this transformation metadata from non standard inputs.
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_sheet_names" in Spreadsheet::Reader::ExcelXML
"good_load( $state )" in Spreadsheet::Reader::ExcelXML::XMLReader
These are the methods provided by this role (only).
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
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.
Returns: a full hashref of hashrefs
Definition: returns an ordered arrayref conataining only worksheet names in their visible order from the Excel workbook.
Returns: an arrayref of names
Definition: returns an ordered arrayref conataining only chartsheet names in their visible order from the Excel workbook.
github Spreadsheet::Reader::ExcelXML/issues
1. Nothing currently
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
Spreadsheet::Reader::ExcelXML - the package
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
Log::Shiras
All lines in this package that use Log::Shiras are commented out
To install Spreadsheet::Reader::ExcelXML, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Spreadsheet::Reader::ExcelXML
CPAN shell
perl -MCPAN -e shell install Spreadsheet::Reader::ExcelXML
For more information on module installation, please visit the detailed CPAN module installation guide.