NAME
Spreadsheet::Reader::ExcelXML::WorksheetToRow - Builds row objects from worksheet files
SYNOPSIS
See t\Spreadsheet\Reader\ExcelXML\09-worksheet_to_row.t
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 module provides the generic connection to individual worksheet files (not chartsheets) for parsing xlsx(and xml) workbooks. It does not provide a way to connect to chartsheets . It does not provide the final view of a given cell. The final view of the cell is collated with the role (Interface) Spreadsheet::Reader::ExcelXML::Worksheet. This reader extends the base reader class Spreadsheet::Reader::ExcelXML::XMLReader. This module also uses a file type interpreter. The functionality provided by those modules is not explained here.
For now this module reads each full row (with values) into a Spreadsheet::Reader::ExcelXML::Row instance. It stores either the currently read row or all rows based on the "cache_positions" in Spreadsheet::Reader::ExcelXML setting for Worksheet_instance. When a position past the end of the sheet is called the current row is cleared and an 'EOF' or undef value is returned. See "file_boundary_flags" in Spreadsheet::Reader::ExcelXML for more details.
All positions (row and column places and integers) at this level are stored and returned in count from one mode!
To replace this part in the package look in the raw code of Spreadsheet::Reader::ExcelXML::Workbook and adjust the 'worksheet_interface' key of the $parser_modules variable.
requires
This module is a role and as such only adds incremental methods and attributes to some base class. In order to use this role some base object methods are required. The requirments are listed below with links to the default provider.
"advance_row_position( $element, [$iterations] )" in Spreadsheet::Reader::ExcelXML::FileWorksheet
"build_row_data" in Spreadsheet::Reader::ExcelXML::FileWorksheet
"not_end_of_file" in Spreadsheet::Reader::ExcelXML::XMLReader
"start_the_file_over" in Spreadsheet::Reader::ExcelXML::XMLReader
"close_the_file" in Spreadsheet::Reader::ExcelXML::XMLReader
Attributes
Data passed to new when creating an instance. For access to the values in these attributes see the listed 'attribute methods'. For general information on attributes see Moose::Manual::Attributes. For ways to manage the instance when opened see the Methods.
cache_positions
Definition: This is a boolean value which controls whether the parser caches rows that have been parsed or just stores the top level hash. In general this should repsond to the top level attribute "cache_positions" in Spreadsheet::Reader::ExcelXML
Default: 1 = caching on
Range: (1|0)
attribute methods Methods provided to adjust this attribute
should_cache_positions
Definition: return the attribute value
Methods
These are the methods provided by this class for use within the package but are not intended to be used by the end user. Other private methods not listed here are used in the module but not used by the package. If the private method is listed here then replacement of this module either requires replacing them or rewriting all the associated connecting roles and classes.
has_new_row_inst
Definition: Generally in the processing of a worksheet file there will be a currently active row. This row is stored as an object so elements of the row can be retrieved via delegation
Accepts: nothing
Returns: (1|0) depending on the presence of a currently stored row
get_new_row_number
Definition: This returns the row number (in count from 1 mode) for the currently stored row.
Accepts: nothing
Returns: an integer $row
get_new_column( $column )
Definition: This returns the column data for the selected $column. If the request is for a column with no data then it returns undef. If the column is requested pased the last column with data but before the end of the span it returns 'EOD'. If the request is for a column past the end of the span it returns 'EOF'. THe request and return are all handled in count from 1 context.
Accepts: an integer $column number
Returns: The cell contents for that column (or undef, 'EOD', or 'EOF')
get_new_next_value
Definition: like get_new_column this will return one cell. However, this method will only return cells with content or 'EOR'. The role keeps track of which one was called last even it it was through get_new_column.
Accepts: nothing
Returns: the cell contents or 'EOR'
get_new_row_all
Definition: This is returns an array ref of each of the values in the current row placed in their 'count from 0' position.
Accepts: nothing
Returns: an array ref
go_to_or_past_row( $row )
Definition: This will attempt to advance to the row provided by $row. It will continue to advance past that row until it arrives at a row with values or the end of the file.
Accepts: $row (integer in count from 1 context)
Returns: The actual row number that was arrived at (in count from 1 context)
SUPPORT
TODO
1. If a the primary cell of a merge range is hidden show that value in the top left unhidden cell even when the attribute "spread_merged_values" in Spreadsheet::Reader::ExcelXML::Workbook is not set. (This is the way excel does it(ish))
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