Upgrade to PHP-CS-Fixer 2.0
This commit is contained in:
parent
0de994c998
commit
8c66afe39a
|
@ -1,9 +1,8 @@
|
|||
/build/PHPExcel.phar
|
||||
/tests/codeCoverage
|
||||
/analysis
|
||||
/vendor/
|
||||
/composer.lock
|
||||
/phpunit.xml
|
||||
/.php_cs.cache
|
||||
|
||||
## IDE support
|
||||
*.buildpath
|
||||
|
|
109
.php_cs
109
.php_cs
|
@ -1,109 +0,0 @@
|
|||
<?php
|
||||
|
||||
$finder = Symfony\CS\Finder\DefaultFinder::create()
|
||||
->exclude('vendor')
|
||||
->in('samples')
|
||||
->in('src')
|
||||
->in('tests');
|
||||
|
||||
return Symfony\CS\Config\Config::create()
|
||||
->level(Symfony\CS\FixerInterface::NONE_LEVEL)
|
||||
->fixers([
|
||||
// 'align_double_arrow', // Waste of time
|
||||
// 'align_equals', // Waste of time
|
||||
'array_element_no_space_before_comma',
|
||||
'array_element_white_space_after_comma',
|
||||
'blankline_after_open_tag',
|
||||
'braces',
|
||||
// 'concat_without_spaces', // This make it less readable
|
||||
'concat_with_spaces',
|
||||
'double_arrow_multiline_whitespaces',
|
||||
'duplicate_semicolon',
|
||||
// 'echo_to_print', // We prefer echo
|
||||
'elseif',
|
||||
// 'empty_return', // even if technically useless, we prefer to be explicit with our intent to return null
|
||||
'encoding',
|
||||
'eof_ending',
|
||||
'ereg_to_preg',
|
||||
'extra_empty_lines',
|
||||
'function_call_space',
|
||||
'function_declaration',
|
||||
'function_typehint_space',
|
||||
// 'header_comment', // We don't use common header in all our files
|
||||
'include',
|
||||
'indentation',
|
||||
'join_function',
|
||||
'line_after_namespace',
|
||||
'linefeed',
|
||||
'list_commas',
|
||||
// 'logical_not_operators_with_spaces', // No we prefer to keep "!" without spaces
|
||||
// 'logical_not_operators_with_successor_space', // idem
|
||||
// 'long_array_syntax', // We opted in for the short syntax
|
||||
'lowercase_constants',
|
||||
'lowercase_keywords',
|
||||
'method_argument_space',
|
||||
'multiline_array_trailing_comma',
|
||||
'multiline_spaces_before_semicolon',
|
||||
'multiple_use',
|
||||
'namespace_no_leading_whitespace',
|
||||
'newline_after_open_tag',
|
||||
'new_with_braces',
|
||||
'no_blank_lines_after_class_opening',
|
||||
// 'no_blank_lines_before_namespace', // we want 1 blank line before namespace
|
||||
'no_empty_lines_after_phpdocs',
|
||||
'object_operator',
|
||||
'operators_spaces',
|
||||
'ordered_use',
|
||||
'parenthesis',
|
||||
'php4_constructor',
|
||||
'php_closing_tag',
|
||||
'phpdoc_indent',
|
||||
'phpdoc_inline_tag',
|
||||
'phpdoc_no_access',
|
||||
'phpdoc_no_empty_return',
|
||||
'phpdoc_no_package',
|
||||
'phpdoc_order',
|
||||
// 'phpdoc_params', // Waste of time
|
||||
'phpdoc_scalar',
|
||||
// 'phpdoc_separation', // Nope, annotations are easy to read enough, no need to split them with blank lines
|
||||
// 'phpdoc_short_description', // We usually don't generate documentation so punctuation is not important
|
||||
'phpdoc_to_comment',
|
||||
'phpdoc_trim',
|
||||
'phpdoc_types',
|
||||
'phpdoc_type_to_var',
|
||||
// 'phpdoc_var_to_type', // This is not supported by phpDoc2 anymore
|
||||
'phpdoc_var_without_name',
|
||||
'php_unit_construct',
|
||||
// 'php_unit_strict', // We sometime actually need assertEquals
|
||||
'pre_increment',
|
||||
'print_to_echo',
|
||||
'psr0',
|
||||
'remove_leading_slash_use',
|
||||
'remove_lines_between_uses',
|
||||
'return',
|
||||
'self_accessor',
|
||||
'short_array_syntax',
|
||||
'short_bool_cast',
|
||||
'short_echo_tag',
|
||||
'short_tag',
|
||||
'single_array_no_trailing_comma',
|
||||
'single_blank_line_before_namespace',
|
||||
'single_line_after_imports',
|
||||
'single_quote',
|
||||
'spaces_before_semicolon',
|
||||
'spaces_cast',
|
||||
'standardize_not_equal',
|
||||
// 'strict', // No, too dangerous to change that
|
||||
// 'strict_param', // No, too dangerous to change that
|
||||
// 'ternary_spaces', // That would be nice, but NetBeans does not cooperate :-(
|
||||
'trailing_spaces',
|
||||
'trim_array_spaces',
|
||||
'unalign_double_arrow',
|
||||
'unalign_equals',
|
||||
'unary_operators_spaces',
|
||||
'unneeded_control_parentheses',
|
||||
'unused_use',
|
||||
'visibility',
|
||||
'whitespacy_lines',
|
||||
])
|
||||
->finder($finder);
|
|
@ -0,0 +1,140 @@
|
|||
<?php
|
||||
|
||||
$finder = PhpCsFixer\Finder::create()
|
||||
->exclude('vendor')
|
||||
->in('samples')
|
||||
->in('src')
|
||||
->in('tests');
|
||||
|
||||
return PhpCsFixer\Config::create()
|
||||
->setRiskyAllowed(true)
|
||||
->setFinder($finder)
|
||||
->setRules([
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'binary_operator_spaces' => true,
|
||||
'blank_line_after_namespace' => true,
|
||||
'blank_line_after_opening_tag' => true,
|
||||
'blank_line_before_return' => true,
|
||||
'braces' => true,
|
||||
'cast_spaces' => true,
|
||||
'class_definition' => true,
|
||||
'class_keyword_remove' => false, // ::class keyword gives us beter support in IDE
|
||||
'combine_consecutive_unsets' => true,
|
||||
'concat_space' => ['spacing' => 'one'],
|
||||
'declare_equal_normalize' => true,
|
||||
'declare_strict_types' => false, // Too early to adopt strict types
|
||||
'dir_constant' => true,
|
||||
'elseif' => true,
|
||||
'encoding' => true,
|
||||
'ereg_to_preg' => true,
|
||||
'full_opening_tag' => true,
|
||||
'function_declaration' => true,
|
||||
'function_typehint_space' => true,
|
||||
'general_phpdoc_annotation_remove' => false, // No use for that
|
||||
'hash_to_slash_comment' => true,
|
||||
'header_comment' => false, // We don't use common header in all our files
|
||||
'heredoc_to_nowdoc' => false, // Not sure about this one
|
||||
'include' => true,
|
||||
'indentation_type' => true,
|
||||
'line_ending' => true,
|
||||
'linebreak_after_opening_tag' => true,
|
||||
'lowercase_cast' => true,
|
||||
'lowercase_constants' => true,
|
||||
'lowercase_keywords' => true,
|
||||
'mb_str_functions' => false, // No, too dangerous to change that
|
||||
'method_argument_space' => true,
|
||||
'method_separation' => true,
|
||||
'modernize_types_casting' => true,
|
||||
'native_function_casing' => true,
|
||||
'new_with_braces' => true,
|
||||
'no_alias_functions' => true,
|
||||
'no_blank_lines_after_class_opening' => true,
|
||||
'no_blank_lines_after_phpdoc' => true,
|
||||
'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace
|
||||
'no_closing_tag' => true,
|
||||
'no_empty_comment' => true,
|
||||
'no_empty_phpdoc' => true,
|
||||
'no_empty_statement' => true,
|
||||
'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'useTrait', 'curly_brace_block', 'parenthesis_brace_block', 'square_brace_block'],
|
||||
'no_leading_import_slash' => true,
|
||||
'no_leading_namespace_whitespace' => true,
|
||||
'no_mixed_echo_print' => true,
|
||||
'no_multiline_whitespace_around_double_arrow' => true,
|
||||
'no_multiline_whitespace_before_semicolons' => true,
|
||||
'no_php4_constructor' => true,
|
||||
'no_short_bool_cast' => true,
|
||||
'no_short_echo_tag' => true,
|
||||
'no_singleline_whitespace_before_semicolons' => true,
|
||||
'no_spaces_after_function_name' => true,
|
||||
'no_spaces_around_offset' => true,
|
||||
'no_spaces_inside_parenthesis' => true,
|
||||
'no_trailing_comma_in_list_call' => true,
|
||||
'no_trailing_comma_in_singleline_array' => true,
|
||||
'no_trailing_whitespace' => true,
|
||||
'no_trailing_whitespace_in_comment' => true,
|
||||
'no_unneeded_control_parentheses' => true,
|
||||
'no_unreachable_default_argument_value' => true,
|
||||
'no_unused_imports' => true,
|
||||
'no_useless_else' => true,
|
||||
'no_useless_return' => true,
|
||||
'no_whitespace_before_comma_in_array' => true,
|
||||
'no_whitespace_in_blank_line' => true,
|
||||
'normalize_index_brace' => true,
|
||||
'not_operator_with_space' => false, // No we prefer to keep '!' without spaces
|
||||
'not_operator_with_successor_space' => false, // idem
|
||||
'object_operator_without_whitespace' => true,
|
||||
'ordered_class_elements' => false, // We prefer to keep some freedom
|
||||
'ordered_imports' => true,
|
||||
'php_unit_construct' => true,
|
||||
'php_unit_dedicate_assert' => true,
|
||||
'php_unit_fqcn_annotation' => true,
|
||||
'php_unit_strict' => false, // We sometime actually need assertEquals 'phpdoc_align' => false, // Waste of time
|
||||
'phpdoc_add_missing_param_annotation' => true,
|
||||
'phpdoc_align' => false, // Waste of time
|
||||
'phpdoc_annotation_without_dot' => true,
|
||||
'phpdoc_indent' => true,
|
||||
'phpdoc_inline_tag' => true,
|
||||
'phpdoc_no_access' => true,
|
||||
'phpdoc_no_alias_tag' => true,
|
||||
'phpdoc_no_empty_return' => true,
|
||||
'phpdoc_no_package' => true,
|
||||
'phpdoc_order' => true,
|
||||
'phpdoc_scalar' => true,
|
||||
'phpdoc_separation' => true,
|
||||
'phpdoc_single_line_var_spacing' => true,
|
||||
'phpdoc_summary' => true,
|
||||
'phpdoc_to_comment' => true,
|
||||
'phpdoc_trim' => true,
|
||||
'phpdoc_types' => true,
|
||||
'phpdoc_var_without_name' => true,
|
||||
'pow_to_exponentiation' => false,
|
||||
'pre_increment' => true,
|
||||
'protected_to_private' => true,
|
||||
'psr0' => true,
|
||||
'psr4' => true,
|
||||
'random_api_migration' => false, // This breaks our unit tests
|
||||
'return_type_declaration' => true,
|
||||
'self_accessor' => true,
|
||||
'semicolon_after_instruction' => false, // Buggy in `samples/index.php`
|
||||
'short_scalar_cast' => true,
|
||||
'silenced_deprecation_error' => true,
|
||||
'simplified_null_return' => false, // While technically correct we prefer to be explicit when returning null
|
||||
'single_blank_line_at_eof' => true,
|
||||
'single_blank_line_before_namespace' => true,
|
||||
'single_class_element_per_statement' => true,
|
||||
'single_import_per_statement' => true,
|
||||
'single_line_after_imports' => true,
|
||||
'single_quote' => true,
|
||||
'space_after_semicolon' => true,
|
||||
'standardize_not_equals' => true,
|
||||
'strict_comparison' => false, // No, too dangerous to change that
|
||||
'strict_param' => false, // No, too dangerous to change that
|
||||
'switch_case_semicolon_to_colon' => true,
|
||||
'switch_case_space' => true,
|
||||
'ternary_operator_spaces' => true,
|
||||
'trailing_comma_in_multiline_array' => true,
|
||||
'trim_array_spaces' => true,
|
||||
'unary_operator_spaces' => true,
|
||||
'visibility_required' => true,
|
||||
'whitespace_after_comma_in_array' => true,
|
||||
]);
|
|
@ -33,7 +33,7 @@
|
|||
"squizlabs/php_codesniffer": "2.*",
|
||||
"phpunit/phpunit": "4.6.*",
|
||||
"mikey179/vfsStream": "1.5.*",
|
||||
"friendsofphp/php-cs-fixer": "^1.11"
|
||||
"friendsofphp/php-cs-fixer": "^2.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-zip": "Required to handle .xlsx .ods or .gnumeric files",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet;
|
||||
|
||||
/**
|
||||
* Autoloader for PhpSpreadsheet classes
|
||||
* Autoloader for PhpSpreadsheet classes.
|
||||
*
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
*
|
||||
|
@ -22,13 +22,14 @@ namespace PhpOffice\PhpSpreadsheet;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Autoloader
|
||||
{
|
||||
/**
|
||||
* Register the Autoloader with SPL
|
||||
* Register the Autoloader with SPL.
|
||||
*/
|
||||
public static function register()
|
||||
{
|
||||
|
@ -41,7 +42,7 @@ class Autoloader
|
|||
}
|
||||
|
||||
/**
|
||||
* Autoload a class identified by name
|
||||
* Autoload a class identified by name.
|
||||
*
|
||||
* @param string $className Name of the object to load
|
||||
*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Bootstrap for PhpSpreadsheet classes
|
||||
* Bootstrap for PhpSpreadsheet classes.
|
||||
*
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
*
|
||||
|
@ -20,6 +20,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,20 +20,21 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class APC extends CacheBase implements ICache
|
||||
{
|
||||
/**
|
||||
* Prefix used to uniquely identify cache data for this worksheet
|
||||
* Prefix used to uniquely identify cache data for this worksheet.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $cachePrefix = null;
|
||||
|
||||
/**
|
||||
* Cache timeout
|
||||
* Cache timeout.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
|
@ -41,7 +42,7 @@ class APC extends CacheBase implements ICache
|
|||
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
* and the 'nullify' the current cell object.
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
|
@ -64,11 +65,13 @@ class APC extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
* Add or Update a cell in cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||
*/
|
||||
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||
|
@ -89,7 +92,9 @@ class APC extends CacheBase implements ICache
|
|||
* Is a value set in the current \PhpOffice\PhpSpreadsheet\CachedObjectStorage\ICache for an indexed cell?
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to check
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDataSet($pCoord)
|
||||
|
@ -114,10 +119,12 @@ class APC extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
* Get cell at a specific coordinate.
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
|
@ -151,7 +158,7 @@ class APC extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
* Get a list of all cell addresses currently held in cache.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
|
@ -165,9 +172,10 @@ class APC extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Delete a cell in cache identified by coordinate address
|
||||
* Delete a cell in cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord)
|
||||
|
@ -180,9 +188,10 @@ class APC extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
* Clone the cell collection.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
|
||||
|
@ -210,7 +219,7 @@ class APC extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
* Clear the cell collection and disconnect from our parent.
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
|
@ -229,7 +238,7 @@ class APC extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Initialise this new cell collection
|
||||
* Initialise this new cell collection.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
||||
* @param array of mixed $arguments Additional initialisation arguments
|
||||
|
@ -248,7 +257,7 @@ class APC extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Destroy this cell collection
|
||||
* Destroy this cell collection.
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
|
@ -260,7 +269,7 @@ class APC extends CacheBase implements ICache
|
|||
|
||||
/**
|
||||
* Identify whether the caching method is currently available
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,34 +20,35 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
abstract class CacheBase
|
||||
{
|
||||
/**
|
||||
* Parent worksheet
|
||||
* Parent worksheet.
|
||||
*
|
||||
* @var \PhpOffice\PhpSpreadsheet\Worksheet
|
||||
*/
|
||||
protected $parent;
|
||||
|
||||
/**
|
||||
* The currently active Cell
|
||||
* The currently active Cell.
|
||||
*
|
||||
* @var \PhpOffice\PhpSpreadsheet\Cell
|
||||
*/
|
||||
protected $currentObject = null;
|
||||
|
||||
/**
|
||||
* Coordinate address of the currently active Cell
|
||||
* Coordinate address of the currently active Cell.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $currentObjectID = null;
|
||||
|
||||
/**
|
||||
* Flag indicating whether the currently active Cell requires saving
|
||||
* Flag indicating whether the currently active Cell requires saving.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
|
@ -55,14 +56,14 @@ abstract class CacheBase
|
|||
|
||||
/**
|
||||
* An array of cells or cell pointers for the worksheet cells held in this cache,
|
||||
* and indexed by their coordinate address within the worksheet
|
||||
* and indexed by their coordinate address within the worksheet.
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
protected $cellCache = [];
|
||||
|
||||
/**
|
||||
* Initialise this new cell collection
|
||||
* Initialise this new cell collection.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
||||
*/
|
||||
|
@ -75,7 +76,7 @@ abstract class CacheBase
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the parent worksheet for this cell collection
|
||||
* Return the parent worksheet for this cell collection.
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Worksheet
|
||||
*/
|
||||
|
@ -88,6 +89,7 @@ abstract class CacheBase
|
|||
* Is a value set in the current \PhpOffice\PhpSpreadsheet\CachedObjectStorage\ICache for an indexed cell?
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to check
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDataSet($pCoord)
|
||||
|
@ -100,10 +102,11 @@ abstract class CacheBase
|
|||
}
|
||||
|
||||
/**
|
||||
* Move a cell object from one address to another
|
||||
* Move a cell object from one address to another.
|
||||
*
|
||||
* @param string $fromAddress Current address of the cell to move
|
||||
* @param string $toAddress Destination address of the cell to move
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function moveCell($fromAddress, $toAddress)
|
||||
|
@ -121,10 +124,12 @@ abstract class CacheBase
|
|||
}
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache
|
||||
* Add or Update a cell in cache.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||
*/
|
||||
public function updateCacheData(\PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||
|
@ -133,9 +138,10 @@ abstract class CacheBase
|
|||
}
|
||||
|
||||
/**
|
||||
* Delete a cell in cache identified by coordinate address
|
||||
* Delete a cell in cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord)
|
||||
|
@ -153,7 +159,7 @@ abstract class CacheBase
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
* Get a list of all cell addresses currently held in cache.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
|
@ -163,7 +169,7 @@ abstract class CacheBase
|
|||
}
|
||||
|
||||
/**
|
||||
* Sort the list of all cell addresses currently held in cache by row and column
|
||||
* Sort the list of all cell addresses currently held in cache by row and column.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
|
@ -180,7 +186,7 @@ abstract class CacheBase
|
|||
}
|
||||
|
||||
/**
|
||||
* Get highest worksheet column and highest row that have cell records
|
||||
* Get highest worksheet column and highest row that have cell records.
|
||||
*
|
||||
* @return array Highest column name and highest row number
|
||||
*/
|
||||
|
@ -207,7 +213,7 @@ abstract class CacheBase
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the cell address of the currently active cell object
|
||||
* Return the cell address of the currently active cell object.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -217,7 +223,7 @@ abstract class CacheBase
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the column address of the currently active cell object
|
||||
* Return the column address of the currently active cell object.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -229,7 +235,7 @@ abstract class CacheBase
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the row address of the currently active cell object
|
||||
* Return the row address of the currently active cell object.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
@ -237,14 +243,15 @@ abstract class CacheBase
|
|||
{
|
||||
sscanf($this->currentObjectID, '%[A-Z]%d', $column, $row);
|
||||
|
||||
return (integer) $row;
|
||||
return (int) $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get highest worksheet column
|
||||
* Get highest worksheet column.
|
||||
*
|
||||
* @param string $row Return the highest column for the specified row,
|
||||
* or the highest column of any row if no row number is passed
|
||||
*
|
||||
* @return string Highest column name
|
||||
*/
|
||||
public function getHighestColumn($row = null)
|
||||
|
@ -268,10 +275,11 @@ abstract class CacheBase
|
|||
}
|
||||
|
||||
/**
|
||||
* Get highest worksheet row
|
||||
* Get highest worksheet row.
|
||||
*
|
||||
* @param string $column Return the highest row for the specified column,
|
||||
* or the highest row of any column if no column letter is passed
|
||||
*
|
||||
* @return int Highest row number
|
||||
*/
|
||||
public function getHighestRow($column = null)
|
||||
|
@ -295,7 +303,7 @@ abstract class CacheBase
|
|||
}
|
||||
|
||||
/**
|
||||
* Generate a unique ID for cache referencing
|
||||
* Generate a unique ID for cache referencing.
|
||||
*
|
||||
* @return string Unique Reference
|
||||
*/
|
||||
|
@ -311,7 +319,7 @@ abstract class CacheBase
|
|||
}
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
* Clone the cell collection.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||
*/
|
||||
|
@ -327,7 +335,7 @@ abstract class CacheBase
|
|||
}
|
||||
|
||||
/**
|
||||
* Remove a row, deleting all cells in that row
|
||||
* Remove a row, deleting all cells in that row.
|
||||
*
|
||||
* @param string $row Row number to remove
|
||||
*/
|
||||
|
@ -342,7 +350,7 @@ abstract class CacheBase
|
|||
}
|
||||
|
||||
/**
|
||||
* Remove a column, deleting all cells in that column
|
||||
* Remove a column, deleting all cells in that column.
|
||||
*
|
||||
* @param string $column Column ID to remove
|
||||
*/
|
||||
|
@ -358,7 +366,7 @@ abstract class CacheBase
|
|||
|
||||
/**
|
||||
* Identify whether the caching method is currently available
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,27 +20,28 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class DiscISAM extends CacheBase implements ICache
|
||||
{
|
||||
/**
|
||||
* Name of the file for this cache
|
||||
* Name of the file for this cache.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $fileName = null;
|
||||
|
||||
/**
|
||||
* File handle for this cache file
|
||||
* File handle for this cache file.
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
private $fileHandle = null;
|
||||
|
||||
/**
|
||||
* Directory/Folder where the cache file is located
|
||||
* Directory/Folder where the cache file is located.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
@ -48,7 +49,7 @@ class DiscISAM extends CacheBase implements ICache
|
|||
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
* and the 'nullify' the current cell object.
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
|
@ -69,11 +70,13 @@ class DiscISAM extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
* Add or Update a cell in cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||
*/
|
||||
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||
|
@ -90,10 +93,12 @@ class DiscISAM extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
* Get cell at a specific coordinate.
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
|
@ -121,7 +126,7 @@ class DiscISAM extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
* Get a list of all cell addresses currently held in cache.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
|
@ -135,7 +140,7 @@ class DiscISAM extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
* Clone the cell collection.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||
*/
|
||||
|
@ -153,7 +158,7 @@ class DiscISAM extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
* Clear the cell collection and disconnect from our parent.
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
|
@ -171,7 +176,7 @@ class DiscISAM extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Initialise this new cell collection
|
||||
* Initialise this new cell collection.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
||||
* @param array of mixed $arguments Additional initialisation arguments
|
||||
|
@ -191,7 +196,7 @@ class DiscISAM extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Destroy this cell collection
|
||||
* Destroy this cell collection.
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,43 +20,51 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
interface ICache
|
||||
{
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
* Add or Update a cell in cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||
*/
|
||||
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell);
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache
|
||||
* Add or Update a cell in cache.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||
*/
|
||||
public function updateCacheData(\PhpOffice\PhpSpreadsheet\Cell $cell);
|
||||
|
||||
/**
|
||||
* Fetch a cell from cache identified by coordinate address
|
||||
* Fetch a cell from cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to retrieve
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord);
|
||||
|
||||
/**
|
||||
* Delete a cell in cache identified by coordinate address
|
||||
* Delete a cell in cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord);
|
||||
|
@ -65,26 +73,27 @@ interface ICache
|
|||
* Is a value set in the current \PhpOffice\PhpSpreadsheet\CachedObjectStorage\ICache for an indexed cell?
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to check
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDataSet($pCoord);
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
* Get a list of all cell addresses currently held in cache.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getCellList();
|
||||
|
||||
/**
|
||||
* Get the list of all cell addresses currently held in cache sorted by column and row
|
||||
* Get the list of all cell addresses currently held in cache sorted by column and row.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getSortedCellList();
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
* Clone the cell collection.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||
*/
|
||||
|
@ -92,7 +101,7 @@ interface ICache
|
|||
|
||||
/**
|
||||
* Identify whether the caching method is currently available
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -27,7 +28,7 @@ class Igbinary extends CacheBase implements ICache
|
|||
{
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
* and the 'nullify' the current cell object.
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
|
@ -40,14 +41,18 @@ class Igbinary extends CacheBase implements ICache
|
|||
$this->currentCellIsDirty = false;
|
||||
}
|
||||
$this->currentObjectID = $this->currentObject = null;
|
||||
} // function _storeData()
|
||||
}
|
||||
|
||||
// function _storeData()
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
* Add or Update a cell in cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||
*/
|
||||
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||
|
@ -64,10 +69,12 @@ class Igbinary extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
* Get cell at a specific coordinate.
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
|
@ -91,10 +98,12 @@ class Igbinary extends CacheBase implements ICache
|
|||
|
||||
// Return requested entry
|
||||
return $this->currentObject;
|
||||
} // function getCacheData()
|
||||
}
|
||||
|
||||
// function getCacheData()
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
* Get a list of all cell addresses currently held in cache.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
|
@ -108,7 +117,7 @@ class Igbinary extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
* Clear the cell collection and disconnect from our parent.
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
|
@ -120,11 +129,13 @@ class Igbinary extends CacheBase implements ICache
|
|||
|
||||
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||
$this->parent = null;
|
||||
} // function unsetWorksheetCells()
|
||||
}
|
||||
|
||||
// function unsetWorksheetCells()
|
||||
|
||||
/**
|
||||
* Identify whether the caching method is currently available
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,27 +20,28 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Memcache extends CacheBase implements ICache
|
||||
{
|
||||
/**
|
||||
* Prefix used to uniquely identify cache data for this worksheet
|
||||
* Prefix used to uniquely identify cache data for this worksheet.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $cachePrefix = null;
|
||||
|
||||
/**
|
||||
* Cache timeout
|
||||
* Cache timeout.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $cacheTime = 600;
|
||||
|
||||
/**
|
||||
* Memcache interface
|
||||
* Memcache interface.
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
|
@ -48,7 +49,7 @@ class Memcache extends CacheBase implements ICache
|
|||
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
* and the 'nullify' the current cell object.
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
|
@ -70,11 +71,13 @@ class Memcache extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
* Add or Update a cell in cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||
*/
|
||||
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||
|
@ -95,7 +98,9 @@ class Memcache extends CacheBase implements ICache
|
|||
* Is a value set in the current \PhpOffice\PhpSpreadsheet\CachedObjectStorage\ICache for an indexed cell?
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to check
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDataSet($pCoord)
|
||||
|
@ -120,10 +125,12 @@ class Memcache extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
* Get cell at a specific coordinate.
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
|
@ -157,7 +164,7 @@ class Memcache extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
* Get a list of all cell addresses currently held in cache.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
|
@ -171,9 +178,10 @@ class Memcache extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Delete a cell in cache identified by coordinate address
|
||||
* Delete a cell in cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord)
|
||||
|
@ -186,9 +194,10 @@ class Memcache extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
* Clone the cell collection.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
|
||||
|
@ -216,7 +225,7 @@ class Memcache extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
* Clear the cell collection and disconnect from our parent.
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
|
@ -235,10 +244,11 @@ class Memcache extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Initialise this new cell collection
|
||||
* Initialise this new cell collection.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
||||
* @param mixed[] $arguments Additional initialisation arguments
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
public function __construct(\PhpOffice\PhpSpreadsheet\Worksheet $parent, $arguments)
|
||||
|
@ -263,10 +273,11 @@ class Memcache extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Memcache error handler
|
||||
* Memcache error handler.
|
||||
*
|
||||
* @param string $host Memcache server
|
||||
* @param int $port Memcache port
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
public function failureCallback($host, $port)
|
||||
|
@ -275,7 +286,7 @@ class Memcache extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Destroy this cell collection
|
||||
* Destroy this cell collection.
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
|
@ -287,7 +298,7 @@ class Memcache extends CacheBase implements ICache
|
|||
|
||||
/**
|
||||
* Identify whether the caching method is currently available
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,24 +20,27 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Memory extends CacheBase implements ICache
|
||||
{
|
||||
/**
|
||||
* Dummy method callable from CacheBase, but unused by Memory cache
|
||||
* Dummy method callable from CacheBase, but unused by Memory cache.
|
||||
*/
|
||||
protected function storeData()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
* Add or Update a cell in cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||
*/
|
||||
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||
|
@ -51,10 +54,12 @@ class Memory extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
* Get cell at a specific coordinate.
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
|
@ -74,7 +79,7 @@ class Memory extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
* Clone the cell collection.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||
*/
|
||||
|
@ -92,7 +97,7 @@ class Memory extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
* Clear the cell collection and disconnect from our parent.
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -27,7 +28,7 @@ class MemoryGZip extends CacheBase implements ICache
|
|||
{
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
* and the 'nullify' the current cell object.
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
|
@ -43,11 +44,13 @@ class MemoryGZip extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
* Add or Update a cell in cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||
*/
|
||||
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||
|
@ -64,10 +67,12 @@ class MemoryGZip extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
* Get cell at a specific coordinate.
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
|
@ -94,7 +99,7 @@ class MemoryGZip extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
* Get a list of all cell addresses currently held in cache.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
|
@ -108,7 +113,7 @@ class MemoryGZip extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
* Clear the cell collection and disconnect from our parent.
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -27,7 +28,7 @@ class MemorySerialized extends CacheBase implements ICache
|
|||
{
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
* and the 'nullify' the current cell object.
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
|
@ -43,11 +44,13 @@ class MemorySerialized extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
* Add or Update a cell in cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||
*/
|
||||
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||
|
@ -64,10 +67,12 @@ class MemorySerialized extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
* Get cell at a specific coordinate.
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
|
@ -94,7 +99,7 @@ class MemorySerialized extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
* Get a list of all cell addresses currently held in cache.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
|
@ -108,7 +113,7 @@ class MemorySerialized extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
* Clear the cell collection and disconnect from our parent.
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,20 +20,21 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class PHPTemp extends CacheBase implements ICache
|
||||
{
|
||||
/**
|
||||
* Name of the file for this cache
|
||||
* Name of the file for this cache.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $fileHandle = null;
|
||||
|
||||
/**
|
||||
* Memory limit to use before reverting to file cache
|
||||
* Memory limit to use before reverting to file cache.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
|
@ -41,7 +42,7 @@ class PHPTemp extends CacheBase implements ICache
|
|||
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
* and the 'nullify' the current cell object.
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
|
@ -62,11 +63,13 @@ class PHPTemp extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
* Add or Update a cell in cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||
*/
|
||||
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||
|
@ -83,10 +86,12 @@ class PHPTemp extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
* Get cell at a specific coordinate.
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
|
@ -114,7 +119,7 @@ class PHPTemp extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
* Get a list of all cell addresses currently held in cache.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
|
@ -128,7 +133,7 @@ class PHPTemp extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
* Clone the cell collection.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||
*/
|
||||
|
@ -146,7 +151,7 @@ class PHPTemp extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
* Clear the cell collection and disconnect from our parent.
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
|
@ -164,7 +169,7 @@ class PHPTemp extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Initialise this new cell collection
|
||||
* Initialise this new cell collection.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
||||
* @param mixed[] $arguments Additional initialisation arguments
|
||||
|
@ -180,7 +185,7 @@ class PHPTemp extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Destroy this cell collection
|
||||
* Destroy this cell collection.
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,20 +20,21 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class SQLite extends CacheBase implements ICache
|
||||
{
|
||||
/**
|
||||
* Database table name
|
||||
* Database table name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $TableName = null;
|
||||
|
||||
/**
|
||||
* Database handle
|
||||
* Database handle.
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
|
@ -41,7 +42,7 @@ class SQLite extends CacheBase implements ICache
|
|||
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
* and the 'nullify' the current cell object.
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
|
@ -59,11 +60,13 @@ class SQLite extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
* Add or Update a cell in cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||
*/
|
||||
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||
|
@ -80,10 +83,12 @@ class SQLite extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
* Get cell at a specific coordinate.
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
|
@ -118,7 +123,9 @@ class SQLite extends CacheBase implements ICache
|
|||
* Is a value set for an indexed cell?
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to check
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDataSet($pCoord)
|
||||
|
@ -141,9 +148,10 @@ class SQLite extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Delete a cell in cache identified by coordinate address
|
||||
* Delete a cell in cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord)
|
||||
|
@ -163,11 +171,13 @@ class SQLite extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Move a cell object from one address to another
|
||||
* Move a cell object from one address to another.
|
||||
*
|
||||
* @param string $fromAddress Current address of the cell to move
|
||||
* @param string $toAddress Destination address of the cell to move
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function moveCell($fromAddress, $toAddress)
|
||||
|
@ -192,9 +202,10 @@ class SQLite extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
* Get a list of all cell addresses currently held in cache.
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getCellList()
|
||||
|
@ -218,9 +229,10 @@ class SQLite extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
* Clone the cell collection.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
|
||||
|
@ -241,7 +253,7 @@ class SQLite extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
* Clear the cell collection and disconnect from our parent.
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
|
@ -257,9 +269,10 @@ class SQLite extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Initialise this new cell collection
|
||||
* Initialise this new cell collection.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
public function __construct(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
|
||||
|
@ -280,7 +293,7 @@ class SQLite extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Destroy this cell collection
|
||||
* Destroy this cell collection.
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
|
@ -292,7 +305,7 @@ class SQLite extends CacheBase implements ICache
|
|||
|
||||
/**
|
||||
* Identify whether the caching method is currently available
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,48 +20,49 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class SQLite3 extends CacheBase implements ICache
|
||||
{
|
||||
/**
|
||||
* Database table name
|
||||
* Database table name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $TableName = null;
|
||||
|
||||
/**
|
||||
* Database handle
|
||||
* Database handle.
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
private $DBHandle = null;
|
||||
|
||||
/**
|
||||
* Prepared statement for a SQLite3 select query
|
||||
* Prepared statement for a SQLite3 select query.
|
||||
*
|
||||
* @var SQLite3Stmt
|
||||
*/
|
||||
private $selectQuery;
|
||||
|
||||
/**
|
||||
* Prepared statement for a SQLite3 insert query
|
||||
* Prepared statement for a SQLite3 insert query.
|
||||
*
|
||||
* @var SQLite3Stmt
|
||||
*/
|
||||
private $insertQuery;
|
||||
|
||||
/**
|
||||
* Prepared statement for a SQLite3 update query
|
||||
* Prepared statement for a SQLite3 update query.
|
||||
*
|
||||
* @var SQLite3Stmt
|
||||
*/
|
||||
private $updateQuery;
|
||||
|
||||
/**
|
||||
* Prepared statement for a SQLite3 delete query
|
||||
* Prepared statement for a SQLite3 delete query.
|
||||
*
|
||||
* @var SQLite3Stmt
|
||||
*/
|
||||
|
@ -69,7 +70,7 @@ class SQLite3 extends CacheBase implements ICache
|
|||
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
* and the 'nullify' the current cell object.
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
|
@ -90,11 +91,13 @@ class SQLite3 extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
* Add or Update a cell in cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||
*/
|
||||
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||
|
@ -111,11 +114,13 @@ class SQLite3 extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
* Get cell at a specific coordinate.
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
|
@ -151,7 +156,9 @@ class SQLite3 extends CacheBase implements ICache
|
|||
* Is a value set for an indexed cell?
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to check
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDataSet($pCoord)
|
||||
|
@ -172,9 +179,10 @@ class SQLite3 extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Delete a cell in cache identified by coordinate address
|
||||
* Delete a cell in cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord)
|
||||
|
@ -195,11 +203,13 @@ class SQLite3 extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Move a cell object from one address to another
|
||||
* Move a cell object from one address to another.
|
||||
*
|
||||
* @param string $fromAddress Current address of the cell to move
|
||||
* @param string $toAddress Destination address of the cell to move
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function moveCell($fromAddress, $toAddress)
|
||||
|
@ -225,9 +235,10 @@ class SQLite3 extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
* Get a list of all cell addresses currently held in cache.
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getCellList()
|
||||
|
@ -251,9 +262,10 @@ class SQLite3 extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
* Clone the cell collection.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
|
||||
|
@ -274,7 +286,7 @@ class SQLite3 extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
* Clear the cell collection and disconnect from our parent.
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
|
@ -290,9 +302,10 @@ class SQLite3 extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Initialise this new cell collection
|
||||
* Initialise this new cell collection.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
public function __construct(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
|
||||
|
@ -318,7 +331,7 @@ class SQLite3 extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Destroy this cell collection
|
||||
* Destroy this cell collection.
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
|
@ -331,7 +344,7 @@ class SQLite3 extends CacheBase implements ICache
|
|||
|
||||
/**
|
||||
* Identify whether the caching method is currently available
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,20 +20,21 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Wincache extends CacheBase implements ICache
|
||||
{
|
||||
/**
|
||||
* Prefix used to uniquely identify cache data for this worksheet
|
||||
* Prefix used to uniquely identify cache data for this worksheet.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $cachePrefix = null;
|
||||
|
||||
/**
|
||||
* Cache timeout
|
||||
* Cache timeout.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
|
@ -41,7 +42,7 @@ class Wincache extends CacheBase implements ICache
|
|||
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
* and the 'nullify' the current cell object.
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
|
@ -69,11 +70,13 @@ class Wincache extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
* Add or Update a cell in cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||
*/
|
||||
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||
|
@ -94,7 +97,9 @@ class Wincache extends CacheBase implements ICache
|
|||
* Is a value set in the current \PhpOffice\PhpSpreadsheet\CachedObjectStorage\ICache for an indexed cell?
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to check
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDataSet($pCoord)
|
||||
|
@ -119,10 +124,12 @@ class Wincache extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
* Get cell at a specific coordinate.
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
|
@ -158,7 +165,7 @@ class Wincache extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
* Get a list of all cell addresses currently held in cache.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
|
@ -172,9 +179,10 @@ class Wincache extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Delete a cell in cache identified by coordinate address
|
||||
* Delete a cell in cache identified by coordinate address.
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord)
|
||||
|
@ -187,9 +195,10 @@ class Wincache extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
* Clone the cell collection.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
|
||||
|
@ -218,7 +227,7 @@ class Wincache extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
* Clear the cell collection and disconnect from our parent.
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
|
@ -237,7 +246,7 @@ class Wincache extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Initialise this new cell collection
|
||||
* Initialise this new cell collection.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
||||
* @param mixed[] $arguments Additional initialisation arguments
|
||||
|
@ -256,7 +265,7 @@ class Wincache extends CacheBase implements ICache
|
|||
}
|
||||
|
||||
/**
|
||||
* Destroy this cell collection
|
||||
* Destroy this cell collection.
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
|
@ -268,7 +277,7 @@ class Wincache extends CacheBase implements ICache
|
|||
|
||||
/**
|
||||
* Identify whether the caching method is currently available
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -38,21 +39,21 @@ class CachedObjectStorageFactory
|
|||
const CACHE_TO_SQLITE3 = 'SQLite3';
|
||||
|
||||
/**
|
||||
* Name of the method used for cell cacheing
|
||||
* Name of the method used for cell cacheing.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $cacheStorageMethod;
|
||||
|
||||
/**
|
||||
* Name of the class used for cell cacheing
|
||||
* Name of the class used for cell cacheing.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $cacheStorageClass;
|
||||
|
||||
/**
|
||||
* List of all possible cache storage methods
|
||||
* List of all possible cache storage methods.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
|
@ -71,7 +72,7 @@ class CachedObjectStorageFactory
|
|||
];
|
||||
|
||||
/**
|
||||
* Default arguments for each cache storage method
|
||||
* Default arguments for each cache storage method.
|
||||
*
|
||||
* @var array of mixed array
|
||||
*/
|
||||
|
@ -102,14 +103,14 @@ class CachedObjectStorageFactory
|
|||
];
|
||||
|
||||
/**
|
||||
* Arguments for the active cache storage method
|
||||
* Arguments for the active cache storage method.
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
private static $storageMethodParameters = [];
|
||||
|
||||
/**
|
||||
* Return the current cache storage method
|
||||
* Return the current cache storage method.
|
||||
*
|
||||
* @return string|null
|
||||
**/
|
||||
|
@ -119,7 +120,7 @@ class CachedObjectStorageFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the current cache storage class
|
||||
* Return the current cache storage class.
|
||||
*
|
||||
* @return string
|
||||
**/
|
||||
|
@ -129,7 +130,7 @@ class CachedObjectStorageFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the list of all possible cache storage methods
|
||||
* Return the list of all possible cache storage methods.
|
||||
*
|
||||
* @return string[]
|
||||
**/
|
||||
|
@ -139,7 +140,7 @@ class CachedObjectStorageFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the list of all available cache storage methods
|
||||
* Return the list of all available cache storage methods.
|
||||
*
|
||||
* @return string[]
|
||||
**/
|
||||
|
@ -157,11 +158,12 @@ class CachedObjectStorageFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* Identify the cache storage method to use
|
||||
* Identify the cache storage method to use.
|
||||
*
|
||||
* @param string $method Name of the method to use for cell cacheing
|
||||
* @param mixed[] $arguments Additional arguments to pass to the cell caching class
|
||||
* when instantiating
|
||||
*
|
||||
* @return bool
|
||||
**/
|
||||
public static function initialize($method = self::CACHE_IN_MEMORY, $arguments = [])
|
||||
|
@ -191,9 +193,10 @@ class CachedObjectStorageFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* Initialise the cache storage
|
||||
* Initialise the cache storage.
|
||||
*
|
||||
* @param Worksheet $parent Enable cell caching for this worksheet
|
||||
*
|
||||
* @return CachedObjectStorage\ICache
|
||||
**/
|
||||
public static function getInstance(Worksheet $parent)
|
||||
|
@ -217,7 +220,7 @@ class CachedObjectStorageFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear the cache storage
|
||||
* Clear the cache storage.
|
||||
**/
|
||||
public static function finalize()
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\CalcEngine;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,20 +20,21 @@ namespace PhpOffice\PhpSpreadsheet\CalcEngine;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class CyclicReferenceStack
|
||||
{
|
||||
/**
|
||||
* The call stack for calculated cells
|
||||
* The call stack for calculated cells.
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
private $stack = [];
|
||||
|
||||
/**
|
||||
* Return the number of entries on the stack
|
||||
* Return the number of entries on the stack.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
@ -43,7 +44,7 @@ class CyclicReferenceStack
|
|||
}
|
||||
|
||||
/**
|
||||
* Push a new entry onto the stack
|
||||
* Push a new entry onto the stack.
|
||||
*
|
||||
* @param mixed $value
|
||||
*/
|
||||
|
@ -53,7 +54,7 @@ class CyclicReferenceStack
|
|||
}
|
||||
|
||||
/**
|
||||
* Pop the last entry from the stack
|
||||
* Pop the last entry from the stack.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
@ -63,7 +64,7 @@ class CyclicReferenceStack
|
|||
}
|
||||
|
||||
/**
|
||||
* Test to see if a specified entry exists on the stack
|
||||
* Test to see if a specified entry exists on the stack.
|
||||
*
|
||||
* @param mixed $value The value to test
|
||||
*/
|
||||
|
@ -73,7 +74,7 @@ class CyclicReferenceStack
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear the stack
|
||||
* Clear the stack.
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
|
@ -81,7 +82,7 @@ class CyclicReferenceStack
|
|||
}
|
||||
|
||||
/**
|
||||
* Return an array of all entries on the stack
|
||||
* Return an array of all entries on the stack.
|
||||
*
|
||||
* @return mixed[]
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\CalcEngine;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\CalcEngine;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -28,7 +29,7 @@ class Logger
|
|||
/**
|
||||
* Flag to determine whether a debug log should be generated by the calculation engine
|
||||
* If true, then a debug log will be generated
|
||||
* If false, then a debug log will not be generated
|
||||
* If false, then a debug log will not be generated.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
|
@ -38,28 +39,28 @@ class Logger
|
|||
* Flag to determine whether a debug log should be echoed by the calculation engine
|
||||
* If true, then a debug log will be echoed
|
||||
* If false, then a debug log will not be echoed
|
||||
* A debug log can only be echoed if it is generated
|
||||
* A debug log can only be echoed if it is generated.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $echoDebugLog = false;
|
||||
|
||||
/**
|
||||
* The debug log generated by the calculation engine
|
||||
* The debug log generated by the calculation engine.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private $debugLog = [];
|
||||
|
||||
/**
|
||||
* The calculation engine cell reference stack
|
||||
* The calculation engine cell reference stack.
|
||||
*
|
||||
* @var CyclicReferenceStack
|
||||
*/
|
||||
private $cellStack;
|
||||
|
||||
/**
|
||||
* Instantiate a Calculation engine logger
|
||||
* Instantiate a Calculation engine logger.
|
||||
*
|
||||
* @param CyclicReferenceStack $stack
|
||||
*/
|
||||
|
@ -69,7 +70,7 @@ class Logger
|
|||
}
|
||||
|
||||
/**
|
||||
* Enable/Disable Calculation engine logging
|
||||
* Enable/Disable Calculation engine logging.
|
||||
*
|
||||
* @param bool $pValue
|
||||
*/
|
||||
|
@ -79,7 +80,7 @@ class Logger
|
|||
}
|
||||
|
||||
/**
|
||||
* Return whether calculation engine logging is enabled or disabled
|
||||
* Return whether calculation engine logging is enabled or disabled.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -89,7 +90,7 @@ class Logger
|
|||
}
|
||||
|
||||
/**
|
||||
* Enable/Disable echoing of debug log information
|
||||
* Enable/Disable echoing of debug log information.
|
||||
*
|
||||
* @param bool $pValue
|
||||
*/
|
||||
|
@ -99,7 +100,7 @@ class Logger
|
|||
}
|
||||
|
||||
/**
|
||||
* Return whether echoing of debug log information is enabled or disabled
|
||||
* Return whether echoing of debug log information is enabled or disabled.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -109,7 +110,7 @@ class Logger
|
|||
}
|
||||
|
||||
/**
|
||||
* Write an entry to the calculation engine debug log
|
||||
* Write an entry to the calculation engine debug log.
|
||||
*/
|
||||
public function writeDebugLog()
|
||||
{
|
||||
|
@ -130,7 +131,7 @@ class Logger
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear the calculation engine debug log
|
||||
* Clear the calculation engine debug log.
|
||||
*/
|
||||
public function clearLog()
|
||||
{
|
||||
|
@ -138,7 +139,7 @@ class Logger
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the calculation engine debug log
|
||||
* Return the calculation engine debug log.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
|
|
|
@ -20,7 +20,7 @@ if (!defined('CALCULATION_REGEXP_CELLREF')) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -37,6 +37,7 @@ if (!defined('CALCULATION_REGEXP_CELLREF')) {
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -67,35 +68,35 @@ class Calculation
|
|||
private static $returnArrayAsType = self::RETURN_ARRAY_AS_VALUE;
|
||||
|
||||
/**
|
||||
* Instance of this class
|
||||
* Instance of this class.
|
||||
*
|
||||
* @var \PhpOffice\PhpSpreadsheet\Calculation
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Instance of the spreadsheet this Calculation Engine is using
|
||||
* Instance of the spreadsheet this Calculation Engine is using.
|
||||
*
|
||||
* @var PhpSpreadsheet
|
||||
*/
|
||||
private $spreadsheet;
|
||||
|
||||
/**
|
||||
* List of instances of the calculation engine that we've instantiated for individual spreadsheets
|
||||
* List of instances of the calculation engine that we've instantiated for individual spreadsheets.
|
||||
*
|
||||
* @var \PhpOffice\PhpSpreadsheet\Calculation[]
|
||||
*/
|
||||
private static $spreadsheetSets;
|
||||
|
||||
/**
|
||||
* Calculation cache
|
||||
* Calculation cache.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $calculationCache = [];
|
||||
|
||||
/**
|
||||
* Calculation cache enabled
|
||||
* Calculation cache enabled.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
|
@ -103,7 +104,7 @@ class Calculation
|
|||
|
||||
/**
|
||||
* List of operators that can be used within formulae
|
||||
* The true/false value indicates whether it is a binary operator or a unary operator
|
||||
* The true/false value indicates whether it is a binary operator or a unary operator.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
@ -115,7 +116,7 @@ class Calculation
|
|||
];
|
||||
|
||||
/**
|
||||
* List of binary operators (those that expect two operands)
|
||||
* List of binary operators (those that expect two operands).
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
@ -127,7 +128,7 @@ class Calculation
|
|||
];
|
||||
|
||||
/**
|
||||
* The debug log generated by the calculation engine
|
||||
* The debug log generated by the calculation engine.
|
||||
*
|
||||
* @var CalcEngine\Logger
|
||||
*/
|
||||
|
@ -136,21 +137,21 @@ class Calculation
|
|||
/**
|
||||
* Flag to determine how formula errors should be handled
|
||||
* If true, then a user error will be triggered
|
||||
* If false, then an exception will be thrown
|
||||
* If false, then an exception will be thrown.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $suppressFormulaErrors = false;
|
||||
|
||||
/**
|
||||
* Error message for any error that was raised/thrown by the calculation engine
|
||||
* Error message for any error that was raised/thrown by the calculation engine.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $formulaError = null;
|
||||
|
||||
/**
|
||||
* An array of the nested cell references accessed by the calculation engine, used for the debug log
|
||||
* An array of the nested cell references accessed by the calculation engine, used for the debug log.
|
||||
*
|
||||
* @var array of string
|
||||
*/
|
||||
|
@ -161,7 +162,7 @@ class Calculation
|
|||
/**
|
||||
* Current iteration counter for cyclic formulae
|
||||
* If the value is 0 (or less) then cyclic formulae will throw an exception,
|
||||
* otherwise they will iterate to the limit defined here before returning a result
|
||||
* otherwise they will iterate to the limit defined here before returning a result.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
|
@ -170,21 +171,21 @@ class Calculation
|
|||
private $cyclicFormulaCell = '';
|
||||
|
||||
/**
|
||||
* Number of iterations for cyclic formulae
|
||||
* Number of iterations for cyclic formulae.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $cyclicFormulaCount = 1;
|
||||
|
||||
/**
|
||||
* Epsilon Precision used for comparisons in calculations
|
||||
* Epsilon Precision used for comparisons in calculations.
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
private $delta = 0.1e-12;
|
||||
|
||||
/**
|
||||
* The current locale setting
|
||||
* The current locale setting.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
@ -192,7 +193,7 @@ class Calculation
|
|||
|
||||
/**
|
||||
* List of available locale settings
|
||||
* Note that this is read for the locale subdirectory only when requested
|
||||
* Note that this is read for the locale subdirectory only when requested.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
|
@ -201,7 +202,7 @@ class Calculation
|
|||
];
|
||||
|
||||
/**
|
||||
* Locale-specific argument separator for function arguments
|
||||
* Locale-specific argument separator for function arguments.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
@ -209,7 +210,7 @@ class Calculation
|
|||
private static $localeFunctions = [];
|
||||
|
||||
/**
|
||||
* Locale-specific translations for Excel constants (True, False and Null)
|
||||
* Locale-specific translations for Excel constants (True, False and Null).
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
|
@ -221,7 +222,7 @@ class Calculation
|
|||
|
||||
/**
|
||||
* Excel constant string translations to their PHP equivalents
|
||||
* Constant conversion from text name/value to actual (datatyped) value
|
||||
* Constant conversion from text name/value to actual (datatyped) value.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
|
@ -2045,10 +2046,11 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Get an instance of this class
|
||||
* Get an instance of this class.
|
||||
*
|
||||
* @param Spreadsheet $spreadsheet Injected spreadsheet for working with a PhpSpreadsheet Spreadsheet object,
|
||||
* or NULL to create a standalone claculation engine
|
||||
*
|
||||
* @return Calculation
|
||||
*/
|
||||
public static function getInstance(Spreadsheet $spreadsheet = null)
|
||||
|
@ -2068,7 +2070,7 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Unset an instance of this class
|
||||
* Unset an instance of this class.
|
||||
*
|
||||
* @param Spreadsheet $spreadsheet Injected spreadsheet identifying the instance to unset
|
||||
*/
|
||||
|
@ -2079,7 +2081,7 @@ class Calculation
|
|||
|
||||
/**
|
||||
* Flush the calculation cache for any existing instance of this class
|
||||
* but only if a \PhpOffice\PhpSpreadsheet\Calculation instance exists
|
||||
* but only if a \PhpOffice\PhpSpreadsheet\Calculation instance exists.
|
||||
*/
|
||||
public function flushInstance()
|
||||
{
|
||||
|
@ -2087,7 +2089,7 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the debuglog for this claculation engine instance
|
||||
* Get the debuglog for this claculation engine instance.
|
||||
*
|
||||
* @return CalcEngine\Logger
|
||||
*/
|
||||
|
@ -2107,7 +2109,7 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the locale-specific translation of TRUE
|
||||
* Return the locale-specific translation of TRUE.
|
||||
*
|
||||
* @return string locale-specific translation of TRUE
|
||||
*/
|
||||
|
@ -2117,7 +2119,7 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the locale-specific translation of FALSE
|
||||
* Return the locale-specific translation of FALSE.
|
||||
*
|
||||
* @return string locale-specific translation of FALSE
|
||||
*/
|
||||
|
@ -2127,9 +2129,10 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the Array Return Type (Array or Value of first element in the array)
|
||||
* Set the Array Return Type (Array or Value of first element in the array).
|
||||
*
|
||||
* @param string $returnType Array return type
|
||||
*
|
||||
* @return bool Success or failure
|
||||
*/
|
||||
public static function setArrayReturnType($returnType)
|
||||
|
@ -2146,7 +2149,7 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the Array Return Type (Array or Value of first element in the array)
|
||||
* Return the Array Return Type (Array or Value of first element in the array).
|
||||
*
|
||||
* @return string $returnType Array return type
|
||||
*/
|
||||
|
@ -2166,7 +2169,7 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Enable/disable calculation cache
|
||||
* Enable/disable calculation cache.
|
||||
*
|
||||
* @param bool $pValue
|
||||
*/
|
||||
|
@ -2177,7 +2180,7 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Enable calculation cache
|
||||
* Enable calculation cache.
|
||||
*/
|
||||
public function enableCalculationCache()
|
||||
{
|
||||
|
@ -2185,7 +2188,7 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Disable calculation cache
|
||||
* Disable calculation cache.
|
||||
*/
|
||||
public function disableCalculationCache()
|
||||
{
|
||||
|
@ -2193,7 +2196,7 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear calculation cache
|
||||
* Clear calculation cache.
|
||||
*/
|
||||
public function clearCalculationCache()
|
||||
{
|
||||
|
@ -2201,7 +2204,7 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear calculation cache for a specified worksheet
|
||||
* Clear calculation cache for a specified worksheet.
|
||||
*
|
||||
* @param string $worksheetName
|
||||
*/
|
||||
|
@ -2213,7 +2216,7 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Rename calculation cache for a specified worksheet
|
||||
* Rename calculation cache for a specified worksheet.
|
||||
*
|
||||
* @param string $fromWorksheetName
|
||||
* @param string $toWorksheetName
|
||||
|
@ -2227,7 +2230,7 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the currently defined locale code
|
||||
* Get the currently defined locale code.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -2237,9 +2240,10 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the locale code
|
||||
* Set the locale code.
|
||||
*
|
||||
* @param string $locale The locale to use for formula translation
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setLocale($locale = 'en_us')
|
||||
|
@ -2347,6 +2351,9 @@ class Calculation
|
|||
/**
|
||||
* @param string $fromSeparator
|
||||
* @param string $toSeparator
|
||||
* @param mixed $from
|
||||
* @param mixed $to
|
||||
* @param mixed $formula
|
||||
*/
|
||||
private static function translateFormula($from, $to, $formula, $fromSeparator, $toSeparator)
|
||||
{
|
||||
|
@ -2452,9 +2459,10 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Wrap string values in quotes
|
||||
* Wrap string values in quotes.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function wrapResult($value)
|
||||
|
@ -2476,15 +2484,16 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Remove quotes used as a wrapper to identify string values
|
||||
* Remove quotes used as a wrapper to identify string values.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function unwrapResult($value)
|
||||
{
|
||||
if (is_string($value)) {
|
||||
if ((isset($value{0})) && ($value{0} == '"') && (substr($value, -1) == '"')) {
|
||||
if ((isset($value[0])) && ($value[0] == '"') && (substr($value, -1) == '"')) {
|
||||
return substr($value, 1, -1);
|
||||
}
|
||||
// Convert numeric errors to NAN error
|
||||
|
@ -2497,10 +2506,12 @@ class Calculation
|
|||
|
||||
/**
|
||||
* Calculate cell value (using formula from a cell ID)
|
||||
* Retained for backward compatibility
|
||||
* Retained for backward compatibility.
|
||||
*
|
||||
* @param Cell $pCell Cell to calculate
|
||||
*
|
||||
* @throws Calculation\Exception
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function calculate(Cell $pCell = null)
|
||||
|
@ -2513,11 +2524,13 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Calculate the value of a cell formula
|
||||
* Calculate the value of a cell formula.
|
||||
*
|
||||
* @param Cell $pCell Cell to calculate
|
||||
* @param bool $resetLog Flag indicating whether the debug log should be reset or not
|
||||
*
|
||||
* @throws Calculation\Exception
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function calculateCellValue(Cell $pCell = null, $resetLog = true)
|
||||
|
@ -2588,10 +2601,12 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Validate and parse a formula string
|
||||
* Validate and parse a formula string.
|
||||
*
|
||||
* @param string $formula Formula to parse
|
||||
*
|
||||
* @throws Calculation\Exception
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function parseFormula($formula)
|
||||
|
@ -2599,11 +2614,11 @@ class Calculation
|
|||
// Basic validation that this is indeed a formula
|
||||
// We return an empty array if not
|
||||
$formula = trim($formula);
|
||||
if ((!isset($formula{0})) || ($formula{0} != '=')) {
|
||||
if ((!isset($formula[0])) || ($formula[0] != '=')) {
|
||||
return [];
|
||||
}
|
||||
$formula = ltrim(substr($formula, 1));
|
||||
if (!isset($formula{0})) {
|
||||
if (!isset($formula[0])) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -2612,12 +2627,14 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Calculate the value of a formula
|
||||
* Calculate the value of a formula.
|
||||
*
|
||||
* @param string $formula Formula to parse
|
||||
* @param string $cellID Address of the cell to calculate
|
||||
* @param Cell $pCell Cell to calculate
|
||||
*
|
||||
* @throws Calculation\Exception
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function calculateFormula($formula, $cellID = null, Cell $pCell = null)
|
||||
|
@ -2670,6 +2687,7 @@ class Calculation
|
|||
|
||||
/**
|
||||
* @param string $cellReference
|
||||
* @param mixed $cellValue
|
||||
*/
|
||||
public function saveValueToCache($cellReference, $cellValue)
|
||||
{
|
||||
|
@ -2679,12 +2697,14 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Parse a cell formula and calculate its value
|
||||
* Parse a cell formula and calculate its value.
|
||||
*
|
||||
* @param string $formula The formula to parse and calculate
|
||||
* @param string $cellID The ID (e.g. A3) of the cell that we are calculating
|
||||
* @param Cell $pCell Cell to calculate
|
||||
*
|
||||
* @throws Calculation\Exception
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function _calculateFormulaValue($formula, $cellID = null, Cell $pCell = null)
|
||||
|
@ -2694,11 +2714,11 @@ class Calculation
|
|||
// Basic validation that this is indeed a formula
|
||||
// We simply return the cell value if not
|
||||
$formula = trim($formula);
|
||||
if ($formula{0} != '=') {
|
||||
if ($formula[0] != '=') {
|
||||
return self::wrapResult($formula);
|
||||
}
|
||||
$formula = ltrim(substr($formula, 1));
|
||||
if (!isset($formula{0})) {
|
||||
if (!isset($formula[0])) {
|
||||
return self::wrapResult($formula);
|
||||
}
|
||||
|
||||
|
@ -2710,7 +2730,7 @@ class Calculation
|
|||
return $cellValue;
|
||||
}
|
||||
|
||||
if (($wsTitle{0} !== "\x00") && ($this->cyclicReferenceStack->onStack($wsCellReference))) {
|
||||
if (($wsTitle[0] !== "\x00") && ($this->cyclicReferenceStack->onStack($wsCellReference))) {
|
||||
if ($this->cyclicFormulaCount <= 0) {
|
||||
$this->cyclicFormulaCell = '';
|
||||
|
||||
|
@ -2745,7 +2765,7 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Ensure that paired matrix operands are both matrices and of the same size
|
||||
* Ensure that paired matrix operands are both matrices and of the same size.
|
||||
*
|
||||
* @param mixed &$operand1 First matrix operand
|
||||
* @param mixed &$operand2 Second matrix operand
|
||||
|
@ -2788,9 +2808,10 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Read the dimensions of a matrix, and re-index it with straight numeric keys starting from row 0, column 0
|
||||
* Read the dimensions of a matrix, and re-index it with straight numeric keys starting from row 0, column 0.
|
||||
*
|
||||
* @param mixed &$matrix matrix operand
|
||||
*
|
||||
* @return int[] An array comprising the number of rows, and number of columns
|
||||
*/
|
||||
private static function getMatrixDimensions(&$matrix)
|
||||
|
@ -2811,7 +2832,7 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Ensure that paired matrix operands are both matrices of the same size
|
||||
* Ensure that paired matrix operands are both matrices of the same size.
|
||||
*
|
||||
* @param mixed &$matrix1 First matrix operand
|
||||
* @param mixed &$matrix2 Second matrix operand
|
||||
|
@ -2854,7 +2875,7 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Ensure that paired matrix operands are both matrices of the same size
|
||||
* Ensure that paired matrix operands are both matrices of the same size.
|
||||
*
|
||||
* @param mixed &$matrix1 First matrix operand
|
||||
* @param mixed &$matrix2 Second matrix operand
|
||||
|
@ -2901,9 +2922,10 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Format details of an operand for display in the log (based on operand type)
|
||||
* Format details of an operand for display in the log (based on operand type).
|
||||
*
|
||||
* @param mixed $value First matrix operand
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private function showValue($value)
|
||||
|
@ -2938,9 +2960,10 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Format type and details of an operand for display in the log (based on operand type)
|
||||
* Format type and details of an operand for display in the log (based on operand type).
|
||||
*
|
||||
* @param mixed $value First matrix operand
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
private function showTypeDetails($value)
|
||||
|
@ -2964,11 +2987,10 @@ class Calculation
|
|||
} else {
|
||||
if ($value == '') {
|
||||
return 'an empty string';
|
||||
} elseif ($value{0} == '#') {
|
||||
} elseif ($value[0] == '#') {
|
||||
return 'a ' . $value . ' error';
|
||||
} else {
|
||||
$typeString = 'a string';
|
||||
}
|
||||
$typeString = 'a string';
|
||||
}
|
||||
|
||||
return $typeString . ' with a value of ' . $this->showValue($value);
|
||||
|
@ -3011,15 +3033,15 @@ class Calculation
|
|||
if ($openCount < $closeCount) {
|
||||
if ($openCount > 0) {
|
||||
return $this->raiseFormulaError("Formula Error: Mismatched matrix braces '}'");
|
||||
} else {
|
||||
return $this->raiseFormulaError("Formula Error: Unexpected '}' encountered");
|
||||
}
|
||||
|
||||
return $this->raiseFormulaError("Formula Error: Unexpected '}' encountered");
|
||||
} elseif ($openCount > $closeCount) {
|
||||
if ($closeCount > 0) {
|
||||
return $this->raiseFormulaError("Formula Error: Mismatched matrix braces '{'");
|
||||
} else {
|
||||
return $this->raiseFormulaError("Formula Error: Unexpected '{' encountered");
|
||||
}
|
||||
|
||||
return $this->raiseFormulaError("Formula Error: Unexpected '{' encountered");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3093,9 +3115,9 @@ class Calculation
|
|||
// The guts of the lexical parser
|
||||
// Loop through the formula extracting each operator and operand in turn
|
||||
while (true) {
|
||||
$opCharacter = $formula{$index}; // Get the first character of the value at the current index position
|
||||
if ((isset(self::$comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$comparisonOperators[$formula{$index + 1}]))) {
|
||||
$opCharacter .= $formula{++$index};
|
||||
$opCharacter = $formula[$index]; // Get the first character of the value at the current index position
|
||||
if ((isset(self::$comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$comparisonOperators[$formula[$index + 1]]))) {
|
||||
$opCharacter .= $formula[++$index];
|
||||
}
|
||||
|
||||
// Find out if we're currently at the beginning of a number, variable, cell reference, function, parenthesis or operand
|
||||
|
@ -3126,9 +3148,8 @@ class Calculation
|
|||
while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last (
|
||||
if ($o2 === null) {
|
||||
return $this->raiseFormulaError('Formula Error: Unexpected closing brace ")"');
|
||||
} else {
|
||||
$output[] = $o2;
|
||||
}
|
||||
$output[] = $o2;
|
||||
}
|
||||
$d = $stack->last(2);
|
||||
if (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $d['value'], $matches)) { // Did this parenthesis just close a function?
|
||||
|
@ -3192,9 +3213,8 @@ class Calculation
|
|||
while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last (
|
||||
if ($o2 === null) {
|
||||
return $this->raiseFormulaError('Formula Error: Unexpected ,');
|
||||
} else {
|
||||
$output[] = $o2; // pop the argument expression stuff and push onto the output
|
||||
}
|
||||
$output[] = $o2; // pop the argument expression stuff and push onto the output
|
||||
}
|
||||
// If we've a comma when we're expecting an operand, then what we actually have is a null operand;
|
||||
// so push a null onto the stack
|
||||
|
@ -3278,7 +3298,7 @@ class Calculation
|
|||
if ($rangeWS2 != '') {
|
||||
$rangeWS2 .= '!';
|
||||
}
|
||||
if ((is_integer($startRowColRef)) && (ctype_digit($val)) &&
|
||||
if ((is_int($startRowColRef)) && (ctype_digit($val)) &&
|
||||
($startRowColRef <= 1048576) && ($val <= 1048576)) {
|
||||
// Row range
|
||||
$endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestColumn() : 'XFD'; // Max 16,384 columns for Excel2007
|
||||
|
@ -3301,7 +3321,7 @@ class Calculation
|
|||
if ((strpos($val, '.') !== false) || (stripos($val, 'e') !== false) || ($val > PHP_INT_MAX) || ($val < -PHP_INT_MAX)) {
|
||||
$val = (float) $val;
|
||||
} else {
|
||||
$val = (integer) $val;
|
||||
$val = (int) $val;
|
||||
}
|
||||
} elseif (isset(self::$excelConstants[trim(strtoupper($val))])) {
|
||||
$excelConstant = trim(strtoupper($val));
|
||||
|
@ -3337,16 +3357,15 @@ class Calculation
|
|||
// Only valid for the % unary operator
|
||||
if ((isset(self::$operators[$opCharacter])) && ($opCharacter != '%')) {
|
||||
return $this->raiseFormulaError("Formula Error: Operator '$opCharacter' has no operands");
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Ignore white space
|
||||
while (($formula{$index} == "\n") || ($formula{$index} == "\r")) {
|
||||
while (($formula[$index] == "\n") || ($formula[$index] == "\r")) {
|
||||
++$index;
|
||||
}
|
||||
if ($formula{$index} == ' ') {
|
||||
while ($formula{$index} == ' ') {
|
||||
if ($formula[$index] == ' ') {
|
||||
while ($formula[$index] == ' ') {
|
||||
++$index;
|
||||
}
|
||||
// If we're expecting an operator, but only have a space between the previous and next operands (and both are
|
||||
|
@ -3395,6 +3414,7 @@ class Calculation
|
|||
|
||||
/**
|
||||
* @param string $cellID
|
||||
* @param mixed $tokens
|
||||
*/
|
||||
private function processTokenStack($tokens, $cellID = null, Cell $pCell = null)
|
||||
{
|
||||
|
@ -3734,7 +3754,7 @@ class Calculation
|
|||
$excelConstant = strtoupper($token);
|
||||
$stack->push('Constant Value', self::$excelConstants[$excelConstant]);
|
||||
$this->_debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->showTypeDetails(self::$excelConstants[$excelConstant]));
|
||||
} elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token{0} == '"') || ($token{0} == '#')) {
|
||||
} elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token[0] == '"') || ($token[0] == '#')) {
|
||||
$stack->push('Value', $token);
|
||||
// if the token is a named range, push the named range name onto the stack
|
||||
} elseif (preg_match('/^' . self::CALCULATION_REGEXP_NAMEDRANGE . '$/i', $token, $matches)) {
|
||||
|
@ -3775,13 +3795,13 @@ class Calculation
|
|||
if (is_string($operand)) {
|
||||
// We only need special validations for the operand if it is a string
|
||||
// Start by stripping off the quotation marks we use to identify true excel string values internally
|
||||
if ($operand > '' && $operand{0} == '"') {
|
||||
if ($operand > '' && $operand[0] == '"') {
|
||||
$operand = self::unwrapResult($operand);
|
||||
}
|
||||
// If the string is a numeric value, we treat it as a numeric, so no further testing
|
||||
if (!is_numeric($operand)) {
|
||||
// If not a numeric, test to see if the value is an Excel error, and so can't be used in normal binary operations
|
||||
if ($operand > '' && $operand{0} == '#') {
|
||||
if ($operand > '' && $operand[0] == '#') {
|
||||
$stack->push('Value', $operand);
|
||||
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($operand));
|
||||
|
||||
|
@ -3839,10 +3859,10 @@ class Calculation
|
|||
}
|
||||
|
||||
// Simple validate the two operands if they are string values
|
||||
if (is_string($operand1) && $operand1 > '' && $operand1{0} == '"') {
|
||||
if (is_string($operand1) && $operand1 > '' && $operand1[0] == '"') {
|
||||
$operand1 = self::unwrapResult($operand1);
|
||||
}
|
||||
if (is_string($operand2) && $operand2 > '' && $operand2{0} == '"') {
|
||||
if (is_string($operand2) && $operand2 > '' && $operand2[0] == '"') {
|
||||
$operand2 = self::unwrapResult($operand2);
|
||||
}
|
||||
|
||||
|
@ -3923,9 +3943,11 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Compare two strings in the same way as strcmp() except that lowercase come before uppercase letters
|
||||
* Compare two strings in the same way as strcmp() except that lowercase come before uppercase letters.
|
||||
*
|
||||
* @param string $str1 First string value for the comparison
|
||||
* @param string $str2 Second string value for the comparison
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function strcmpLowercaseFirst($str1, $str2)
|
||||
|
@ -3938,6 +3960,10 @@ class Calculation
|
|||
|
||||
/**
|
||||
* @param string $matrixFunction
|
||||
* @param mixed $cellID
|
||||
* @param mixed $operand1
|
||||
* @param mixed $operand2
|
||||
* @param mixed $operation
|
||||
*/
|
||||
private function executeNumericBinaryOperation($cellID, $operand1, $operand2, $operation, $matrixFunction, &$stack)
|
||||
{
|
||||
|
@ -3994,9 +4020,9 @@ class Calculation
|
|||
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails('#DIV/0!'));
|
||||
|
||||
return false;
|
||||
} else {
|
||||
$result = $operand1 / $operand2;
|
||||
}
|
||||
$result = $operand1 / $operand2;
|
||||
|
||||
break;
|
||||
// Power
|
||||
case '^':
|
||||
|
@ -4026,12 +4052,14 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Extract range values
|
||||
* Extract range values.
|
||||
*
|
||||
* @param string &$pRange String based range representation
|
||||
* @param Worksheet $pSheet Worksheet
|
||||
* @param bool $resetLog Flag indicating whether calculation log should be reset or not
|
||||
*
|
||||
* @throws Calculation\Exception
|
||||
*
|
||||
* @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned.
|
||||
*/
|
||||
public function extractCellRange(&$pRange = 'A1', Worksheet $pSheet = null, $resetLog = true)
|
||||
|
@ -4077,12 +4105,14 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Extract range values
|
||||
* Extract range values.
|
||||
*
|
||||
* @param string &$pRange String based range representation
|
||||
* @param Worksheet $pSheet Worksheet
|
||||
* @param bool $resetLog Flag indicating whether calculation log should be reset or not
|
||||
*
|
||||
* @throws Calculation\Exception
|
||||
*
|
||||
* @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned.
|
||||
*/
|
||||
public function extractNamedRange(&$pRange = 'A1', Worksheet $pSheet = null, $resetLog = true)
|
||||
|
@ -4146,6 +4176,7 @@ class Calculation
|
|||
* Is a specific function implemented?
|
||||
*
|
||||
* @param string $pFunction Function Name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isImplemented($pFunction = '')
|
||||
|
@ -4153,13 +4184,13 @@ class Calculation
|
|||
$pFunction = strtoupper($pFunction);
|
||||
if (isset(self::$phpSpreadsheetFunctions[$pFunction])) {
|
||||
return self::$phpSpreadsheetFunctions[$pFunction]['functionCall'] !== '\\PhpOffice\\PhpSpreadsheet\\Calculation\\Functions::DUMMY';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all implemented functions as an array of function objects
|
||||
* Get a list of all implemented functions as an array of function objects.
|
||||
*
|
||||
* @return array of Calculation\Category
|
||||
*/
|
||||
|
@ -4169,7 +4200,7 @@ class Calculation
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a list of implemented Excel function names
|
||||
* Get a list of implemented Excel function names.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Calculation;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Calculation;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Database
|
||||
{
|
||||
/**
|
||||
* fieldExtract
|
||||
* fieldExtract.
|
||||
*
|
||||
* Extracts the column ID to use for the data field.
|
||||
*
|
||||
|
@ -39,6 +40,7 @@ class Database
|
|||
* "Age" or "Yield," or a number (without quotation marks) that
|
||||
* represents the position of the column within the list: 1 for
|
||||
* the first column, 2 for the second column, and so on.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
private static function fieldExtract($database, $field)
|
||||
|
@ -57,7 +59,7 @@ class Database
|
|||
}
|
||||
|
||||
/**
|
||||
* filter
|
||||
* filter.
|
||||
*
|
||||
* Parses the selection criteria, extracts the database rows that match those criteria, and
|
||||
* returns that subset of rows.
|
||||
|
@ -71,6 +73,7 @@ class Database
|
|||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
*
|
||||
* @return array of mixed
|
||||
*/
|
||||
private static function filter($database, $criteria)
|
||||
|
@ -142,7 +145,7 @@ class Database
|
|||
}
|
||||
|
||||
/**
|
||||
* DAVERAGE
|
||||
* DAVERAGE.
|
||||
*
|
||||
* Averages the values in a column of a list or database that match conditions you specify.
|
||||
*
|
||||
|
@ -150,6 +153,7 @@ class Database
|
|||
* DAVERAGE(database,field,criteria)
|
||||
*
|
||||
* @category Database Functions
|
||||
*
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
|
@ -164,6 +168,7 @@ class Database
|
|||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function DAVERAGE($database, $field, $criteria)
|
||||
|
@ -180,7 +185,7 @@ class Database
|
|||
}
|
||||
|
||||
/**
|
||||
* DCOUNT
|
||||
* DCOUNT.
|
||||
*
|
||||
* Counts the cells that contain numbers in a column of a list or database that match conditions
|
||||
* that you specify.
|
||||
|
@ -192,6 +197,7 @@ class Database
|
|||
* DAVERAGE(database,field,criteria)
|
||||
*
|
||||
* @category Database Functions
|
||||
*
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
|
@ -206,6 +212,7 @@ class Database
|
|||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @TODO The field argument is optional. If field is omitted, DCOUNT counts all records in the
|
||||
|
@ -225,7 +232,7 @@ class Database
|
|||
}
|
||||
|
||||
/**
|
||||
* DCOUNTA
|
||||
* DCOUNTA.
|
||||
*
|
||||
* Counts the nonblank cells in a column of a list or database that match conditions that you specify.
|
||||
*
|
||||
|
@ -233,6 +240,7 @@ class Database
|
|||
* DCOUNTA(database,[field],criteria)
|
||||
*
|
||||
* @category Database Functions
|
||||
*
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
|
@ -247,6 +255,7 @@ class Database
|
|||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @TODO The field argument is optional. If field is omitted, DCOUNTA counts all records in the
|
||||
|
@ -274,7 +283,7 @@ class Database
|
|||
}
|
||||
|
||||
/**
|
||||
* DGET
|
||||
* DGET.
|
||||
*
|
||||
* Extracts a single value from a column of a list or database that matches conditions that you
|
||||
* specify.
|
||||
|
@ -283,6 +292,7 @@ class Database
|
|||
* DGET(database,field,criteria)
|
||||
*
|
||||
* @category Database Functions
|
||||
*
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
|
@ -297,6 +307,7 @@ class Database
|
|||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function DGET($database, $field, $criteria)
|
||||
|
@ -316,7 +327,7 @@ class Database
|
|||
}
|
||||
|
||||
/**
|
||||
* DMAX
|
||||
* DMAX.
|
||||
*
|
||||
* Returns the largest number in a column of a list or database that matches conditions you that
|
||||
* specify.
|
||||
|
@ -325,6 +336,7 @@ class Database
|
|||
* DMAX(database,field,criteria)
|
||||
*
|
||||
* @category Database Functions
|
||||
*
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
|
@ -339,6 +351,7 @@ class Database
|
|||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function DMAX($database, $field, $criteria)
|
||||
|
@ -355,7 +368,7 @@ class Database
|
|||
}
|
||||
|
||||
/**
|
||||
* DMIN
|
||||
* DMIN.
|
||||
*
|
||||
* Returns the smallest number in a column of a list or database that matches conditions you that
|
||||
* specify.
|
||||
|
@ -364,6 +377,7 @@ class Database
|
|||
* DMIN(database,field,criteria)
|
||||
*
|
||||
* @category Database Functions
|
||||
*
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
|
@ -378,6 +392,7 @@ class Database
|
|||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function DMIN($database, $field, $criteria)
|
||||
|
@ -394,7 +409,7 @@ class Database
|
|||
}
|
||||
|
||||
/**
|
||||
* DPRODUCT
|
||||
* DPRODUCT.
|
||||
*
|
||||
* Multiplies the values in a column of a list or database that match conditions that you specify.
|
||||
*
|
||||
|
@ -402,6 +417,7 @@ class Database
|
|||
* DPRODUCT(database,field,criteria)
|
||||
*
|
||||
* @category Database Functions
|
||||
*
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
|
@ -416,6 +432,7 @@ class Database
|
|||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function DPRODUCT($database, $field, $criteria)
|
||||
|
@ -432,7 +449,7 @@ class Database
|
|||
}
|
||||
|
||||
/**
|
||||
* DSTDEV
|
||||
* DSTDEV.
|
||||
*
|
||||
* Estimates the standard deviation of a population based on a sample by using the numbers in a
|
||||
* column of a list or database that match conditions that you specify.
|
||||
|
@ -441,6 +458,7 @@ class Database
|
|||
* DSTDEV(database,field,criteria)
|
||||
*
|
||||
* @category Database Functions
|
||||
*
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
|
@ -455,6 +473,7 @@ class Database
|
|||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function DSTDEV($database, $field, $criteria)
|
||||
|
@ -471,7 +490,7 @@ class Database
|
|||
}
|
||||
|
||||
/**
|
||||
* DSTDEVP
|
||||
* DSTDEVP.
|
||||
*
|
||||
* Calculates the standard deviation of a population based on the entire population by using the
|
||||
* numbers in a column of a list or database that match conditions that you specify.
|
||||
|
@ -480,6 +499,7 @@ class Database
|
|||
* DSTDEVP(database,field,criteria)
|
||||
*
|
||||
* @category Database Functions
|
||||
*
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
|
@ -494,6 +514,7 @@ class Database
|
|||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function DSTDEVP($database, $field, $criteria)
|
||||
|
@ -510,7 +531,7 @@ class Database
|
|||
}
|
||||
|
||||
/**
|
||||
* DSUM
|
||||
* DSUM.
|
||||
*
|
||||
* Adds the numbers in a column of a list or database that match conditions that you specify.
|
||||
*
|
||||
|
@ -518,6 +539,7 @@ class Database
|
|||
* DSUM(database,field,criteria)
|
||||
*
|
||||
* @category Database Functions
|
||||
*
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
|
@ -532,6 +554,7 @@ class Database
|
|||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function DSUM($database, $field, $criteria)
|
||||
|
@ -548,7 +571,7 @@ class Database
|
|||
}
|
||||
|
||||
/**
|
||||
* DVAR
|
||||
* DVAR.
|
||||
*
|
||||
* Estimates the variance of a population based on a sample by using the numbers in a column
|
||||
* of a list or database that match conditions that you specify.
|
||||
|
@ -557,6 +580,7 @@ class Database
|
|||
* DVAR(database,field,criteria)
|
||||
*
|
||||
* @category Database Functions
|
||||
*
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
|
@ -571,6 +595,7 @@ class Database
|
|||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function DVAR($database, $field, $criteria)
|
||||
|
@ -587,7 +612,7 @@ class Database
|
|||
}
|
||||
|
||||
/**
|
||||
* DVARP
|
||||
* DVARP.
|
||||
*
|
||||
* Calculates the variance of a population based on the entire population by using the numbers
|
||||
* in a column of a list or database that match conditions that you specify.
|
||||
|
@ -596,6 +621,7 @@ class Database
|
|||
* DVARP(database,field,criteria)
|
||||
*
|
||||
* @category Database Functions
|
||||
*
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
|
@ -610,6 +636,7 @@ class Database
|
|||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function DVARP($database, $field, $criteria)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Calculation;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,15 +20,17 @@ namespace PhpOffice\PhpSpreadsheet\Calculation;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class DateTime
|
||||
{
|
||||
/**
|
||||
* Identify if a year is a leap year or not
|
||||
* Identify if a year is a leap year or not.
|
||||
*
|
||||
* @param int $year The year to test
|
||||
*
|
||||
* @return bool TRUE if the year is a leap year, otherwise FALSE
|
||||
*/
|
||||
public static function isLeapYear($year)
|
||||
|
@ -37,7 +39,7 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the number of days between two dates based on a 360 day calendar
|
||||
* Return the number of days between two dates based on a 360 day calendar.
|
||||
*
|
||||
* @param int $startDay Day of month of the start date
|
||||
* @param int $startMonth Month of the start date
|
||||
|
@ -46,6 +48,7 @@ class DateTime
|
|||
* @param int $endMonth Month of the start date
|
||||
* @param int $endYear Year of the start date
|
||||
* @param bool $methodUS Whether to use the US method or the European method of calculation
|
||||
*
|
||||
* @return int Number of days between the start date and the end date
|
||||
*/
|
||||
private static function dateDiff360($startDay, $startMonth, $startYear, $endDay, $endMonth, $endYear, $methodUS)
|
||||
|
@ -73,9 +76,10 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* getDateValue
|
||||
* getDateValue.
|
||||
*
|
||||
* @param string $dateValue
|
||||
*
|
||||
* @return mixed Excel date/time serial value, or string if error
|
||||
*/
|
||||
public static function getDateValue($dateValue)
|
||||
|
@ -99,9 +103,10 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* getTimeValue
|
||||
* getTimeValue.
|
||||
*
|
||||
* @param string $timeValue
|
||||
*
|
||||
* @return mixed Excel date/time serial value, or string if error
|
||||
*/
|
||||
private static function getTimeValue($timeValue)
|
||||
|
@ -142,7 +147,7 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* DATETIMENOW
|
||||
* DATETIMENOW.
|
||||
*
|
||||
* Returns the current date and time.
|
||||
* The NOW function is useful when you need to display the current date and time on a worksheet or
|
||||
|
@ -156,6 +161,7 @@ class DateTime
|
|||
* NOW()
|
||||
*
|
||||
* @category Date/Time Functions
|
||||
*
|
||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||
* depending on the value of the ReturnDateType flag
|
||||
*/
|
||||
|
@ -169,7 +175,7 @@ class DateTime
|
|||
$retValue = (float) \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel(time());
|
||||
break;
|
||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||
$retValue = (integer) time();
|
||||
$retValue = (int) time();
|
||||
break;
|
||||
case Functions::RETURNDATE_PHP_OBJECT:
|
||||
$retValue = new \DateTime();
|
||||
|
@ -181,7 +187,7 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* DATENOW
|
||||
* DATENOW.
|
||||
*
|
||||
* Returns the current date.
|
||||
* The NOW function is useful when you need to display the current date and time on a worksheet or
|
||||
|
@ -195,6 +201,7 @@ class DateTime
|
|||
* TODAY()
|
||||
*
|
||||
* @category Date/Time Functions
|
||||
*
|
||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||
* depending on the value of the ReturnDateType flag
|
||||
*/
|
||||
|
@ -209,7 +216,7 @@ class DateTime
|
|||
$retValue = (float) $excelDateTime;
|
||||
break;
|
||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||
$retValue = (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateTime);
|
||||
$retValue = (int) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateTime);
|
||||
break;
|
||||
case Functions::RETURNDATE_PHP_OBJECT:
|
||||
$retValue = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($excelDateTime);
|
||||
|
@ -221,7 +228,7 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* DATE
|
||||
* DATE.
|
||||
*
|
||||
* The DATE function returns a value that represents a particular date.
|
||||
*
|
||||
|
@ -236,6 +243,7 @@ class DateTime
|
|||
* as will a day value with a suffix (e.g. '21st' rather than simply 21); again only English language.
|
||||
*
|
||||
* @category Date/Time Functions
|
||||
*
|
||||
* @param int $year The value of the year argument can include one to four digits.
|
||||
* Excel interprets the year argument according to the configured
|
||||
* date system: 1900 or 1904.
|
||||
|
@ -266,6 +274,7 @@ class DateTime
|
|||
* days, plus one, from the first day of the month specified. For
|
||||
* example, DATE(2008,1,-15) returns the serial number representing
|
||||
* December 16, 2007.
|
||||
*
|
||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||
* depending on the value of the ReturnDateType flag
|
||||
*/
|
||||
|
@ -291,9 +300,9 @@ class DateTime
|
|||
(!is_numeric($day))) {
|
||||
return Functions::VALUE();
|
||||
}
|
||||
$year = (integer) $year;
|
||||
$month = (integer) $month;
|
||||
$day = (integer) $day;
|
||||
$year = (int) $year;
|
||||
$month = (int) $month;
|
||||
$day = (int) $day;
|
||||
|
||||
$baseYear = \PhpOffice\PhpSpreadsheet\Shared\Date::getExcelCalendar();
|
||||
// Validate parameters
|
||||
|
@ -330,14 +339,14 @@ class DateTime
|
|||
case Functions::RETURNDATE_EXCEL:
|
||||
return (float) $excelDateValue;
|
||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||
return (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue);
|
||||
return (int) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue);
|
||||
case Functions::RETURNDATE_PHP_OBJECT:
|
||||
return \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($excelDateValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TIME
|
||||
* TIME.
|
||||
*
|
||||
* The TIME function returns a value that represents a particular time.
|
||||
*
|
||||
|
@ -348,6 +357,7 @@ class DateTime
|
|||
* TIME(hour,minute,second)
|
||||
*
|
||||
* @category Date/Time Functions
|
||||
*
|
||||
* @param int $hour A number from 0 (zero) to 32767 representing the hour.
|
||||
* Any value greater than 23 will be divided by 24 and the remainder
|
||||
* will be treated as the hour value. For example, TIME(27,0,0) =
|
||||
|
@ -359,6 +369,7 @@ class DateTime
|
|||
* Any value greater than 59 will be converted to hours, minutes,
|
||||
* and seconds. For example, TIME(0,0,2000) = TIME(0,33,22) = .023148
|
||||
* or 12:33:20 AM
|
||||
*
|
||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||
* depending on the value of the ReturnDateType flag
|
||||
*/
|
||||
|
@ -381,9 +392,9 @@ class DateTime
|
|||
if ((!is_numeric($hour)) || (!is_numeric($minute)) || (!is_numeric($second))) {
|
||||
return Functions::VALUE();
|
||||
}
|
||||
$hour = (integer) $hour;
|
||||
$minute = (integer) $minute;
|
||||
$second = (integer) $second;
|
||||
$hour = (int) $hour;
|
||||
$minute = (int) $minute;
|
||||
$second = (int) $second;
|
||||
|
||||
if ($second < 0) {
|
||||
$minute += floor($second / 60);
|
||||
|
@ -423,7 +434,7 @@ class DateTime
|
|||
|
||||
return (float) \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second);
|
||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||
return (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600
|
||||
return (int) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600
|
||||
case Functions::RETURNDATE_PHP_OBJECT:
|
||||
$dayAdjust = 0;
|
||||
if ($hour < 0) {
|
||||
|
@ -446,7 +457,7 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* DATEVALUE
|
||||
* DATEVALUE.
|
||||
*
|
||||
* Returns a value that represents a particular date.
|
||||
* Use DATEVALUE to convert a date represented by a text string to an Excel or PHP date/time stamp
|
||||
|
@ -459,6 +470,7 @@ class DateTime
|
|||
* DATEVALUE(dateValue)
|
||||
*
|
||||
* @category Date/Time Functions
|
||||
*
|
||||
* @param string $dateValue Text that represents a date in a Microsoft Excel date format.
|
||||
* For example, "1/30/2008" or "30-Jan-2008" are text strings within
|
||||
* quotation marks that represent dates. Using the default date
|
||||
|
@ -467,6 +479,7 @@ class DateTime
|
|||
* system in Excel for the Macintosh, date_text must represent a date
|
||||
* from January 1, 1904, to December 31, 9999. DATEVALUE returns the
|
||||
* #VALUE! error value if date_text is out of this range.
|
||||
*
|
||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||
* depending on the value of the ReturnDateType flag
|
||||
*/
|
||||
|
@ -485,14 +498,13 @@ class DateTime
|
|||
if ((is_numeric($t)) && ($t > 31)) {
|
||||
if ($yearFound) {
|
||||
return Functions::VALUE();
|
||||
} else {
|
||||
}
|
||||
if ($t < 100) {
|
||||
$t += 1900;
|
||||
}
|
||||
$yearFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((count($t1) == 1) && (strpos($t, ':') != false)) {
|
||||
// We've been fed a time value without any date
|
||||
return 0.0;
|
||||
|
@ -571,7 +583,7 @@ class DateTime
|
|||
case Functions::RETURNDATE_EXCEL:
|
||||
return (float) $excelDateValue;
|
||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||
return (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue);
|
||||
return (int) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue);
|
||||
case Functions::RETURNDATE_PHP_OBJECT:
|
||||
return new \DateTime($PHPDateArray['year'] . '-' . $PHPDateArray['month'] . '-' . $PHPDateArray['day'] . ' 00:00:00');
|
||||
}
|
||||
|
@ -581,7 +593,7 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* TIMEVALUE
|
||||
* TIMEVALUE.
|
||||
*
|
||||
* Returns a value that represents a particular time.
|
||||
* Use TIMEVALUE to convert a time represented by a text string to an Excel or PHP date/time stamp
|
||||
|
@ -594,10 +606,12 @@ class DateTime
|
|||
* TIMEVALUE(timeValue)
|
||||
*
|
||||
* @category Date/Time Functions
|
||||
*
|
||||
* @param string $timeValue A text string that represents a time in any one of the Microsoft
|
||||
* Excel time formats; for example, "6:45 PM" and "18:45" text strings
|
||||
* within quotation marks that represent time.
|
||||
* Date information in time_text is ignored.
|
||||
*
|
||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||
* depending on the value of the ReturnDateType flag
|
||||
*/
|
||||
|
@ -631,7 +645,7 @@ class DateTime
|
|||
case Functions::RETURNDATE_EXCEL:
|
||||
return (float) $excelDateValue;
|
||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||
return (integer) $phpDateValue = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue + 25569) - 3600;
|
||||
return (int) $phpDateValue = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue + 25569) - 3600;
|
||||
case Functions::RETURNDATE_PHP_OBJECT:
|
||||
return new \DateTime('1900-01-01 ' . $PHPDateArray['hour'] . ':' . $PHPDateArray['minute'] . ':' . $PHPDateArray['second']);
|
||||
}
|
||||
|
@ -641,13 +655,14 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* DATEDIF
|
||||
* DATEDIF.
|
||||
*
|
||||
* @param mixed $startDate Excel date serial value, PHP date/time stamp, PHP DateTime object
|
||||
* or a standard date string
|
||||
* @param mixed $endDate Excel date serial value, PHP date/time stamp, PHP DateTime object
|
||||
* or a standard date string
|
||||
* @param string $unit
|
||||
*
|
||||
* @return int Interval between the dates
|
||||
*/
|
||||
public static function DATEDIF($startDate = 0, $endDate = 0, $unit = 'D')
|
||||
|
@ -684,17 +699,17 @@ class DateTime
|
|||
$retVal = Functions::NAN();
|
||||
switch ($unit) {
|
||||
case 'D':
|
||||
$retVal = intval($difference);
|
||||
$retVal = (int) $difference;
|
||||
break;
|
||||
case 'M':
|
||||
$retVal = intval($endMonths - $startMonths) + (intval($endYears - $startYears) * 12);
|
||||
$retVal = (int) ($endMonths - $startMonths) + ((int) ($endYears - $startYears) * 12);
|
||||
// We're only interested in full months
|
||||
if ($endDays < $startDays) {
|
||||
--$retVal;
|
||||
}
|
||||
break;
|
||||
case 'Y':
|
||||
$retVal = intval($endYears - $startYears);
|
||||
$retVal = (int) ($endYears - $startYears);
|
||||
// We're only interested in full months
|
||||
if ($endMonths < $startMonths) {
|
||||
--$retVal;
|
||||
|
@ -716,7 +731,7 @@ class DateTime
|
|||
}
|
||||
break;
|
||||
case 'YM':
|
||||
$retVal = intval($endMonths - $startMonths);
|
||||
$retVal = (int) ($endMonths - $startMonths);
|
||||
if ($retVal < 0) {
|
||||
$retVal += 12;
|
||||
}
|
||||
|
@ -726,7 +741,7 @@ class DateTime
|
|||
}
|
||||
break;
|
||||
case 'YD':
|
||||
$retVal = intval($difference);
|
||||
$retVal = (int) $difference;
|
||||
if ($endYears > $startYears) {
|
||||
$isLeapStartYear = $PHPStartDateObject->format('L');
|
||||
$wasLeapEndYear = $PHPEndDateObject->format('L');
|
||||
|
@ -757,7 +772,7 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* DAYS360
|
||||
* DAYS360.
|
||||
*
|
||||
* Returns the number of days between two dates based on a 360-day year (twelve 30-day months),
|
||||
* which is used in some accounting calculations. Use this function to help compute payments if
|
||||
|
@ -767,6 +782,7 @@ class DateTime
|
|||
* DAYS360(startDate,endDate[,method])
|
||||
*
|
||||
* @category Date/Time Functions
|
||||
*
|
||||
* @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer),
|
||||
* PHP DateTime object, or a standard date string
|
||||
* @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer),
|
||||
|
@ -782,6 +798,7 @@ class DateTime
|
|||
* TRUE: European method. Starting dates and ending dates that
|
||||
* occur on the 31st of a month become equal to the 30th of the
|
||||
* same month.
|
||||
*
|
||||
* @return int Number of days between start date and end date
|
||||
*/
|
||||
public static function DAYS360($startDate = 0, $endDate = 0, $method = false)
|
||||
|
@ -815,7 +832,7 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* YEARFRAC
|
||||
* YEARFRAC.
|
||||
*
|
||||
* Calculates the fraction of the year represented by the number of whole days between two dates
|
||||
* (the start_date and the end_date).
|
||||
|
@ -826,6 +843,7 @@ class DateTime
|
|||
* YEARFRAC(startDate,endDate[,method])
|
||||
*
|
||||
* @category Date/Time Functions
|
||||
*
|
||||
* @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer),
|
||||
* PHP DateTime object, or a standard date string
|
||||
* @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer),
|
||||
|
@ -836,6 +854,7 @@ class DateTime
|
|||
* 2 Actual/360
|
||||
* 3 Actual/365
|
||||
* 4 European 30/360
|
||||
*
|
||||
* @return float fraction of the year
|
||||
*/
|
||||
public static function YEARFRAC($startDate = 0, $endDate = 0, $method = 0)
|
||||
|
@ -913,7 +932,7 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* NETWORKDAYS
|
||||
* NETWORKDAYS.
|
||||
*
|
||||
* Returns the number of whole working days between start_date and end_date. Working days
|
||||
* exclude weekends and any dates identified in holidays.
|
||||
|
@ -924,10 +943,12 @@ class DateTime
|
|||
* NETWORKDAYS(startDate,endDate[,holidays[,holiday[,...]]])
|
||||
*
|
||||
* @category Date/Time Functions
|
||||
*
|
||||
* @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer),
|
||||
* PHP DateTime object, or a standard date string
|
||||
* @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer),
|
||||
* PHP DateTime object, or a standard date string
|
||||
*
|
||||
* @return int Interval between the dates
|
||||
*/
|
||||
public static function NETWORKDAYS($startDate, $endDate)
|
||||
|
@ -993,7 +1014,7 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* WORKDAY
|
||||
* WORKDAY.
|
||||
*
|
||||
* Returns the date that is the indicated number of working days before or after a date (the
|
||||
* starting date). Working days exclude weekends and any dates identified as holidays.
|
||||
|
@ -1004,11 +1025,13 @@ class DateTime
|
|||
* WORKDAY(startDate,endDays[,holidays[,holiday[,...]]])
|
||||
*
|
||||
* @category Date/Time Functions
|
||||
*
|
||||
* @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer),
|
||||
* PHP DateTime object, or a standard date string
|
||||
* @param int $endDays The number of nonweekend and nonholiday days before or after
|
||||
* startDate. A positive value for days yields a future date; a
|
||||
* negative value yields a past date.
|
||||
*
|
||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||
* depending on the value of the ReturnDateType flag
|
||||
*/
|
||||
|
@ -1043,7 +1066,7 @@ class DateTime
|
|||
}
|
||||
|
||||
// Add endDays
|
||||
$endDate = (float) $startDate + (intval($endDays / 5) * 7) + ($endDays % 5);
|
||||
$endDate = (float) $startDate + ((int) ($endDays / 5) * 7) + ($endDays % 5);
|
||||
|
||||
// Adjust the calculated end date if it falls over a weekend
|
||||
$endDoW = self::WEEKDAY($endDate, 3);
|
||||
|
@ -1097,14 +1120,14 @@ class DateTime
|
|||
case Functions::RETURNDATE_EXCEL:
|
||||
return (float) $endDate;
|
||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||
return (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($endDate);
|
||||
return (int) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($endDate);
|
||||
case Functions::RETURNDATE_PHP_OBJECT:
|
||||
return \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($endDate);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DAYOFMONTH
|
||||
* DAYOFMONTH.
|
||||
*
|
||||
* Returns the day of the month, for a specified date. The day is given as an integer
|
||||
* ranging from 1 to 31.
|
||||
|
@ -1114,6 +1137,7 @@ class DateTime
|
|||
*
|
||||
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
||||
* PHP DateTime object, or a standard date string
|
||||
*
|
||||
* @return int Day of the month
|
||||
*/
|
||||
public static function DAYOFMONTH($dateValue = 1)
|
||||
|
@ -1137,7 +1161,7 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* WEEKDAY
|
||||
* WEEKDAY.
|
||||
*
|
||||
* Returns the day of the week for a specified date. The day is given as an integer
|
||||
* ranging from 0 to 7 (dependent on the requested style).
|
||||
|
@ -1151,6 +1175,7 @@ class DateTime
|
|||
* 1 or omitted Numbers 1 (Sunday) through 7 (Saturday).
|
||||
* 2 Numbers 1 (Monday) through 7 (Sunday).
|
||||
* 3 Numbers 0 (Monday) through 6 (Sunday).
|
||||
*
|
||||
* @return int Day of the week value
|
||||
*/
|
||||
public static function WEEKDAY($dateValue = 1, $style = 1)
|
||||
|
@ -1209,7 +1234,7 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* WEEKNUM
|
||||
* WEEKNUM.
|
||||
*
|
||||
* Returns the week of the year for a specified date.
|
||||
* The WEEKNUM function considers the week containing January 1 to be the first week of the year.
|
||||
|
@ -1226,6 +1251,7 @@ class DateTime
|
|||
* @param int $method Week begins on Sunday or Monday
|
||||
* 1 or omitted Week begins on Sunday.
|
||||
* 2 Week begins on Monday.
|
||||
*
|
||||
* @return int Week Number
|
||||
*/
|
||||
public static function WEEKNUM($dateValue = 1, $method = 1)
|
||||
|
@ -1265,7 +1291,7 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* MONTHOFYEAR
|
||||
* MONTHOFYEAR.
|
||||
*
|
||||
* Returns the month of a date represented by a serial number.
|
||||
* The month is given as an integer, ranging from 1 (January) to 12 (December).
|
||||
|
@ -1275,6 +1301,7 @@ class DateTime
|
|||
*
|
||||
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
||||
* PHP DateTime object, or a standard date string
|
||||
*
|
||||
* @return int Month of the year
|
||||
*/
|
||||
public static function MONTHOFYEAR($dateValue = 1)
|
||||
|
@ -1297,7 +1324,7 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* YEAR
|
||||
* YEAR.
|
||||
*
|
||||
* Returns the year corresponding to a date.
|
||||
* The year is returned as an integer in the range 1900-9999.
|
||||
|
@ -1307,6 +1334,7 @@ class DateTime
|
|||
*
|
||||
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
||||
* PHP DateTime object, or a standard date string
|
||||
*
|
||||
* @return int Year
|
||||
*/
|
||||
public static function YEAR($dateValue = 1)
|
||||
|
@ -1328,7 +1356,7 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* HOUROFDAY
|
||||
* HOUROFDAY.
|
||||
*
|
||||
* Returns the hour of a time value.
|
||||
* The hour is given as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.).
|
||||
|
@ -1338,6 +1366,7 @@ class DateTime
|
|||
*
|
||||
* @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer),
|
||||
* PHP DateTime object, or a standard time string
|
||||
*
|
||||
* @return int Hour
|
||||
*/
|
||||
public static function HOUROFDAY($timeValue = 0)
|
||||
|
@ -1368,7 +1397,7 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* MINUTE
|
||||
* MINUTE.
|
||||
*
|
||||
* Returns the minutes of a time value.
|
||||
* The minute is given as an integer, ranging from 0 to 59.
|
||||
|
@ -1378,6 +1407,7 @@ class DateTime
|
|||
*
|
||||
* @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer),
|
||||
* PHP DateTime object, or a standard time string
|
||||
*
|
||||
* @return int Minute
|
||||
*/
|
||||
public static function MINUTE($timeValue = 0)
|
||||
|
@ -1408,7 +1438,7 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* SECOND
|
||||
* SECOND.
|
||||
*
|
||||
* Returns the seconds of a time value.
|
||||
* The second is given as an integer in the range 0 (zero) to 59.
|
||||
|
@ -1418,6 +1448,7 @@ class DateTime
|
|||
*
|
||||
* @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer),
|
||||
* PHP DateTime object, or a standard time string
|
||||
*
|
||||
* @return int Second
|
||||
*/
|
||||
public static function SECOND($timeValue = 0)
|
||||
|
@ -1448,7 +1479,7 @@ class DateTime
|
|||
}
|
||||
|
||||
/**
|
||||
* EDATE
|
||||
* EDATE.
|
||||
*
|
||||
* Returns the serial number that represents the date that is the indicated number of months
|
||||
* before or after a specified date (the start_date).
|
||||
|
@ -1463,6 +1494,7 @@ class DateTime
|
|||
* @param int $adjustmentMonths The number of months before or after start_date.
|
||||
* A positive value for months yields a future date;
|
||||
* a negative value yields a past date.
|
||||
*
|
||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||
* depending on the value of the ReturnDateType flag
|
||||
*/
|
||||
|
@ -1487,14 +1519,14 @@ class DateTime
|
|||
case Functions::RETURNDATE_EXCEL:
|
||||
return (float) \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject);
|
||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||
return (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject));
|
||||
return (int) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject));
|
||||
case Functions::RETURNDATE_PHP_OBJECT:
|
||||
return $PHPDateObject;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* EOMONTH
|
||||
* EOMONTH.
|
||||
*
|
||||
* Returns the date value for the last day of the month that is the indicated number of months
|
||||
* before or after start_date.
|
||||
|
@ -1508,6 +1540,7 @@ class DateTime
|
|||
* @param int $adjustmentMonths The number of months before or after start_date.
|
||||
* A positive value for months yields a future date;
|
||||
* a negative value yields a past date.
|
||||
*
|
||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||
* depending on the value of the ReturnDateType flag
|
||||
*/
|
||||
|
@ -1535,7 +1568,7 @@ class DateTime
|
|||
case Functions::RETURNDATE_EXCEL:
|
||||
return (float) \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject);
|
||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||
return (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject));
|
||||
return (int) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject));
|
||||
case Functions::RETURNDATE_PHP_OBJECT:
|
||||
return $PHPDateObject;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Calculation;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Exception extends \PhpOffice\PhpSpreadsheet\Exception
|
||||
{
|
||||
/**
|
||||
* Error handler callback
|
||||
* Error handler callback.
|
||||
*
|
||||
* @param mixed $code
|
||||
* @param mixed $string
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Calculation;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* Register errorhandler
|
||||
* Register errorhandler.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -34,7 +35,7 @@ class ExceptionHandler
|
|||
}
|
||||
|
||||
/**
|
||||
* Unregister errorhandler
|
||||
* Unregister errorhandler.
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Calculation;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -66,23 +67,24 @@ class FormulaParser
|
|||
const OPERATORS_POSTFIX = '%';
|
||||
|
||||
/**
|
||||
* Formula
|
||||
* Formula.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $formula;
|
||||
|
||||
/**
|
||||
* Tokens
|
||||
* Tokens.
|
||||
*
|
||||
* @var FormulaToken[]
|
||||
*/
|
||||
private $tokens = [];
|
||||
|
||||
/**
|
||||
* Create a new FormulaParser
|
||||
* Create a new FormulaParser.
|
||||
*
|
||||
* @param string $pFormula Formula to parse
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct($pFormula = '')
|
||||
|
@ -99,7 +101,7 @@ class FormulaParser
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Formula
|
||||
* Get Formula.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -109,23 +111,24 @@ class FormulaParser
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Token
|
||||
* Get Token.
|
||||
*
|
||||
* @param int $pId Token id
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getToken($pId = 0)
|
||||
{
|
||||
if (isset($this->tokens[$pId])) {
|
||||
return $this->tokens[$pId];
|
||||
} else {
|
||||
throw new Exception("Token with id $pId does not exist.");
|
||||
}
|
||||
throw new Exception("Token with id $pId does not exist.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Token count
|
||||
* Get Token count.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
@ -135,7 +138,7 @@ class FormulaParser
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Tokens
|
||||
* Get Tokens.
|
||||
*
|
||||
* @return FormulaToken[]
|
||||
*/
|
||||
|
@ -145,7 +148,7 @@ class FormulaParser
|
|||
}
|
||||
|
||||
/**
|
||||
* Parse to tokens
|
||||
* Parse to tokens.
|
||||
*/
|
||||
private function parseToTokens()
|
||||
{
|
||||
|
@ -154,7 +157,7 @@ class FormulaParser
|
|||
|
||||
// Check if the formula has a valid starting =
|
||||
$formulaLength = strlen($this->formula);
|
||||
if ($formulaLength < 2 || $this->formula{0} != '=') {
|
||||
if ($formulaLength < 2 || $this->formula[0] != '=') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -176,8 +179,8 @@ class FormulaParser
|
|||
// embeds are doubled
|
||||
// end marks token
|
||||
if ($inString) {
|
||||
if ($this->formula{$index} == self::QUOTE_DOUBLE) {
|
||||
if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == self::QUOTE_DOUBLE)) {
|
||||
if ($this->formula[$index] == self::QUOTE_DOUBLE) {
|
||||
if ((($index + 2) <= $formulaLength) && ($this->formula[$index + 1] == self::QUOTE_DOUBLE)) {
|
||||
$value .= self::QUOTE_DOUBLE;
|
||||
++$index;
|
||||
} else {
|
||||
|
@ -186,7 +189,7 @@ class FormulaParser
|
|||
$value = '';
|
||||
}
|
||||
} else {
|
||||
$value .= $this->formula{$index};
|
||||
$value .= $this->formula[$index];
|
||||
}
|
||||
++$index;
|
||||
continue;
|
||||
|
@ -196,15 +199,15 @@ class FormulaParser
|
|||
// embeds are double
|
||||
// end does not mark a token
|
||||
if ($inPath) {
|
||||
if ($this->formula{$index} == self::QUOTE_SINGLE) {
|
||||
if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == self::QUOTE_SINGLE)) {
|
||||
if ($this->formula[$index] == self::QUOTE_SINGLE) {
|
||||
if ((($index + 2) <= $formulaLength) && ($this->formula[$index + 1] == self::QUOTE_SINGLE)) {
|
||||
$value .= self::QUOTE_SINGLE;
|
||||
++$index;
|
||||
} else {
|
||||
$inPath = false;
|
||||
}
|
||||
} else {
|
||||
$value .= $this->formula{$index};
|
||||
$value .= $this->formula[$index];
|
||||
}
|
||||
++$index;
|
||||
continue;
|
||||
|
@ -214,10 +217,10 @@ class FormulaParser
|
|||
// no embeds (changed to "()" by Excel)
|
||||
// end does not mark a token
|
||||
if ($inRange) {
|
||||
if ($this->formula{$index} == self::BRACKET_CLOSE) {
|
||||
if ($this->formula[$index] == self::BRACKET_CLOSE) {
|
||||
$inRange = false;
|
||||
}
|
||||
$value .= $this->formula{$index};
|
||||
$value .= $this->formula[$index];
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
@ -225,7 +228,7 @@ class FormulaParser
|
|||
// error values
|
||||
// end marks a token, determined from absolute list of values
|
||||
if ($inError) {
|
||||
$value .= $this->formula{$index};
|
||||
$value .= $this->formula[$index];
|
||||
++$index;
|
||||
if (in_array($value, $ERRORS)) {
|
||||
$inError = false;
|
||||
|
@ -236,10 +239,10 @@ class FormulaParser
|
|||
}
|
||||
|
||||
// scientific notation check
|
||||
if (strpos(self::OPERATORS_SN, $this->formula{$index}) !== false) {
|
||||
if (strpos(self::OPERATORS_SN, $this->formula[$index]) !== false) {
|
||||
if (strlen($value) > 1) {
|
||||
if (preg_match("/^[1-9]{1}(\.[0-9]+)?E{1}$/", $this->formula{$index}) != 0) {
|
||||
$value .= $this->formula{$index};
|
||||
if (preg_match("/^[1-9]{1}(\.[0-9]+)?E{1}$/", $this->formula[$index]) != 0) {
|
||||
$value .= $this->formula[$index];
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
@ -249,7 +252,7 @@ class FormulaParser
|
|||
// independent character evaluation (order not important)
|
||||
|
||||
// establish state-dependent character evaluations
|
||||
if ($this->formula{$index} == self::QUOTE_DOUBLE) {
|
||||
if ($this->formula[$index] == self::QUOTE_DOUBLE) {
|
||||
if (strlen($value > 0)) {
|
||||
// unexpected
|
||||
$tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||
|
@ -260,7 +263,7 @@ class FormulaParser
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($this->formula{$index} == self::QUOTE_SINGLE) {
|
||||
if ($this->formula[$index] == self::QUOTE_SINGLE) {
|
||||
if (strlen($value) > 0) {
|
||||
// unexpected
|
||||
$tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||
|
@ -271,14 +274,14 @@ class FormulaParser
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($this->formula{$index} == self::BRACKET_OPEN) {
|
||||
if ($this->formula[$index] == self::BRACKET_OPEN) {
|
||||
$inRange = true;
|
||||
$value .= self::BRACKET_OPEN;
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($this->formula{$index} == self::ERROR_START) {
|
||||
if ($this->formula[$index] == self::ERROR_START) {
|
||||
if (strlen($value) > 0) {
|
||||
// unexpected
|
||||
$tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||
|
@ -291,7 +294,7 @@ class FormulaParser
|
|||
}
|
||||
|
||||
// mark start and end of arrays and array rows
|
||||
if ($this->formula{$index} == self::BRACE_OPEN) {
|
||||
if ($this->formula[$index] == self::BRACE_OPEN) {
|
||||
if (strlen($value) > 0) {
|
||||
// unexpected
|
||||
$tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||
|
@ -310,7 +313,7 @@ class FormulaParser
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($this->formula{$index} == self::SEMICOLON) {
|
||||
if ($this->formula[$index] == self::SEMICOLON) {
|
||||
if (strlen($value) > 0) {
|
||||
$tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$value = '';
|
||||
|
@ -332,7 +335,7 @@ class FormulaParser
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($this->formula{$index} == self::BRACE_CLOSE) {
|
||||
if ($this->formula[$index] == self::BRACE_CLOSE) {
|
||||
if (strlen($value) > 0) {
|
||||
$tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$value = '';
|
||||
|
@ -353,14 +356,14 @@ class FormulaParser
|
|||
}
|
||||
|
||||
// trim white-space
|
||||
if ($this->formula{$index} == self::WHITESPACE) {
|
||||
if ($this->formula[$index] == self::WHITESPACE) {
|
||||
if (strlen($value) > 0) {
|
||||
$tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$value = '';
|
||||
}
|
||||
$tokens1[] = new FormulaToken('', FormulaToken::TOKEN_TYPE_WHITESPACE);
|
||||
++$index;
|
||||
while (($this->formula{$index} == self::WHITESPACE) && ($index < $formulaLength)) {
|
||||
while (($this->formula[$index] == self::WHITESPACE) && ($index < $formulaLength)) {
|
||||
++$index;
|
||||
}
|
||||
continue;
|
||||
|
@ -380,29 +383,29 @@ class FormulaParser
|
|||
}
|
||||
|
||||
// standard infix operators
|
||||
if (strpos(self::OPERATORS_INFIX, $this->formula{$index}) !== false) {
|
||||
if (strpos(self::OPERATORS_INFIX, $this->formula[$index]) !== false) {
|
||||
if (strlen($value) > 0) {
|
||||
$tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$value = '';
|
||||
}
|
||||
$tokens1[] = new FormulaToken($this->formula{$index}, FormulaToken::TOKEN_TYPE_OPERATORINFIX);
|
||||
$tokens1[] = new FormulaToken($this->formula[$index], FormulaToken::TOKEN_TYPE_OPERATORINFIX);
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
// standard postfix operators (only one)
|
||||
if (strpos(self::OPERATORS_POSTFIX, $this->formula{$index}) !== false) {
|
||||
if (strpos(self::OPERATORS_POSTFIX, $this->formula[$index]) !== false) {
|
||||
if (strlen($value) > 0) {
|
||||
$tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$value = '';
|
||||
}
|
||||
$tokens1[] = new FormulaToken($this->formula{$index}, FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX);
|
||||
$tokens1[] = new FormulaToken($this->formula[$index], FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX);
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
// start subexpression or function
|
||||
if ($this->formula{$index} == self::PAREN_OPEN) {
|
||||
if ($this->formula[$index] == self::PAREN_OPEN) {
|
||||
if (strlen($value) > 0) {
|
||||
$tmp = new FormulaToken($value, FormulaToken::TOKEN_TYPE_FUNCTION, FormulaToken::TOKEN_SUBTYPE_START);
|
||||
$tokens1[] = $tmp;
|
||||
|
@ -418,7 +421,7 @@ class FormulaParser
|
|||
}
|
||||
|
||||
// function, subexpression, or array parameters, or operand unions
|
||||
if ($this->formula{$index} == self::COMMA) {
|
||||
if ($this->formula[$index] == self::COMMA) {
|
||||
if (strlen($value) > 0) {
|
||||
$tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$value = '';
|
||||
|
@ -439,7 +442,7 @@ class FormulaParser
|
|||
}
|
||||
|
||||
// stop subexpression
|
||||
if ($this->formula{$index} == self::PAREN_CLOSE) {
|
||||
if ($this->formula[$index] == self::PAREN_CLOSE) {
|
||||
if (strlen($value) > 0) {
|
||||
$tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$value = '';
|
||||
|
@ -455,7 +458,7 @@ class FormulaParser
|
|||
}
|
||||
|
||||
// token accumulation
|
||||
$value .= $this->formula{$index};
|
||||
$value .= $this->formula[$index];
|
||||
++$index;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Calculation;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -75,28 +76,28 @@ class FormulaToken
|
|||
const TOKEN_SUBTYPE_UNION = 'Union';
|
||||
|
||||
/**
|
||||
* Value
|
||||
* Value.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* Token Type (represented by TOKEN_TYPE_*)
|
||||
* Token Type (represented by TOKEN_TYPE_*).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $tokenType;
|
||||
|
||||
/**
|
||||
* Token SubType (represented by TOKEN_SUBTYPE_*)
|
||||
* Token SubType (represented by TOKEN_SUBTYPE_*).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $tokenSubType;
|
||||
|
||||
/**
|
||||
* Create a new FormulaToken
|
||||
* Create a new FormulaToken.
|
||||
*
|
||||
* @param string $pValue
|
||||
* @param string $pTokenType Token type (represented by TOKEN_TYPE_*)
|
||||
|
@ -111,7 +112,7 @@ class FormulaToken
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Value
|
||||
* Get Value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -121,7 +122,7 @@ class FormulaToken
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Value
|
||||
* Set Value.
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
|
@ -131,7 +132,7 @@ class FormulaToken
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Token Type (represented by TOKEN_TYPE_*)
|
||||
* Get Token Type (represented by TOKEN_TYPE_*).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -141,7 +142,7 @@ class FormulaToken
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Token Type
|
||||
* Set Token Type.
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
|
@ -151,7 +152,7 @@ class FormulaToken
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Token SubType (represented by TOKEN_SUBTYPE_*)
|
||||
* Get Token SubType (represented by TOKEN_SUBTYPE_*).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -161,7 +162,7 @@ class FormulaToken
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Token SubType
|
||||
* Set Token SubType.
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
|
|
|
@ -15,7 +15,7 @@ define('MAX_ITERATIONS', 256);
|
|||
define('PRECISION', 8.88E-016);
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -32,6 +32,7 @@ define('PRECISION', 8.88E-016);
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -47,21 +48,21 @@ class Functions
|
|||
const RETURNDATE_EXCEL = 'E';
|
||||
|
||||
/**
|
||||
* Compatibility mode to use for error checking and responses
|
||||
* Compatibility mode to use for error checking and responses.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $compatibilityMode = self::COMPATIBILITY_EXCEL;
|
||||
|
||||
/**
|
||||
* Data Type to use when returning date values
|
||||
* Data Type to use when returning date values.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $returnDateType = self::RETURNDATE_EXCEL;
|
||||
|
||||
/**
|
||||
* List of error codes
|
||||
* List of error codes.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
@ -77,14 +78,16 @@ class Functions
|
|||
];
|
||||
|
||||
/**
|
||||
* Set the Compatibility Mode
|
||||
* Set the Compatibility Mode.
|
||||
*
|
||||
* @category Function Configuration
|
||||
*
|
||||
* @param string $compatibilityMode Compatibility Mode
|
||||
* Permitted values are:
|
||||
* Functions::COMPATIBILITY_EXCEL 'Excel'
|
||||
* Functions::COMPATIBILITY_GNUMERIC 'Gnumeric'
|
||||
* Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc'
|
||||
*
|
||||
* @return bool (Success or Failure)
|
||||
*/
|
||||
public static function setCompatibilityMode($compatibilityMode)
|
||||
|
@ -102,9 +105,10 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the current Compatibility Mode
|
||||
* Return the current Compatibility Mode.
|
||||
*
|
||||
* @category Function Configuration
|
||||
*
|
||||
* @return string Compatibility Mode
|
||||
* Possible Return values are:
|
||||
* Functions::COMPATIBILITY_EXCEL 'Excel'
|
||||
|
@ -117,14 +121,16 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the Return Date Format used by functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object)
|
||||
* Set the Return Date Format used by functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object).
|
||||
*
|
||||
* @category Function Configuration
|
||||
*
|
||||
* @param string $returnDateType Return Date Format
|
||||
* Permitted values are:
|
||||
* Functions::RETURNDATE_PHP_NUMERIC 'P'
|
||||
* Functions::RETURNDATE_PHP_OBJECT 'O'
|
||||
* Functions::RETURNDATE_EXCEL 'E'
|
||||
*
|
||||
* @return bool Success or failure
|
||||
*/
|
||||
public static function setReturnDateType($returnDateType)
|
||||
|
@ -142,9 +148,10 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the current Return Date Format for functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object)
|
||||
* Return the current Return Date Format for functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object).
|
||||
*
|
||||
* @category Function Configuration
|
||||
*
|
||||
* @return string Return Date Format
|
||||
* Possible Return values are:
|
||||
* Functions::RETURNDATE_PHP_NUMERIC 'P'
|
||||
|
@ -157,9 +164,10 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* DUMMY
|
||||
* DUMMY.
|
||||
*
|
||||
* @category Error Returns
|
||||
*
|
||||
* @return string #Not Yet Implemented
|
||||
*/
|
||||
public static function DUMMY()
|
||||
|
@ -168,9 +176,10 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* DIV0
|
||||
* DIV0.
|
||||
*
|
||||
* @category Error Returns
|
||||
*
|
||||
* @return string #Not Yet Implemented
|
||||
*/
|
||||
public static function DIV0()
|
||||
|
@ -179,7 +188,7 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* NA
|
||||
* NA.
|
||||
*
|
||||
* Excel Function:
|
||||
* =NA()
|
||||
|
@ -188,6 +197,7 @@ class Functions
|
|||
* #N/A is the error value that means "no value is available."
|
||||
*
|
||||
* @category Logical Functions
|
||||
*
|
||||
* @return string #N/A!
|
||||
*/
|
||||
public static function NA()
|
||||
|
@ -196,11 +206,12 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* NaN
|
||||
* NaN.
|
||||
*
|
||||
* Returns the error value #NUM!
|
||||
*
|
||||
* @category Error Returns
|
||||
*
|
||||
* @return string #NUM!
|
||||
*/
|
||||
public static function NAN()
|
||||
|
@ -209,11 +220,12 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* NAME
|
||||
* NAME.
|
||||
*
|
||||
* Returns the error value #NAME?
|
||||
*
|
||||
* @category Error Returns
|
||||
*
|
||||
* @return string #NAME?
|
||||
*/
|
||||
public static function NAME()
|
||||
|
@ -222,11 +234,12 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* REF
|
||||
* REF.
|
||||
*
|
||||
* Returns the error value #REF!
|
||||
*
|
||||
* @category Error Returns
|
||||
*
|
||||
* @return string #REF!
|
||||
*/
|
||||
public static function REF()
|
||||
|
@ -235,11 +248,12 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* NULL
|
||||
* NULL.
|
||||
*
|
||||
* Returns the error value #NULL!
|
||||
*
|
||||
* @category Error Returns
|
||||
*
|
||||
* @return string #NULL!
|
||||
*/
|
||||
public static function null()
|
||||
|
@ -248,11 +262,12 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* VALUE
|
||||
* VALUE.
|
||||
*
|
||||
* Returns the error value #VALUE!
|
||||
*
|
||||
* @category Error Returns
|
||||
*
|
||||
* @return string #VALUE!
|
||||
*/
|
||||
public static function VALUE()
|
||||
|
@ -278,16 +293,16 @@ class Functions
|
|||
public static function ifCondition($condition)
|
||||
{
|
||||
$condition = self::flattenSingleValue($condition);
|
||||
if (!isset($condition{0})) {
|
||||
if (!isset($condition[0])) {
|
||||
$condition = '=""';
|
||||
}
|
||||
if (!in_array($condition{0}, ['>', '<', '='])) {
|
||||
if (!in_array($condition[0], ['>', '<', '='])) {
|
||||
if (!is_numeric($condition)) {
|
||||
$condition = \PhpOffice\PhpSpreadsheet\Calculation::wrapResult(strtoupper($condition));
|
||||
}
|
||||
|
||||
return '=' . $condition;
|
||||
} else {
|
||||
}
|
||||
preg_match('/([<>=]+)(.*)/', $condition, $matches);
|
||||
list(, $operator, $operand) = $matches;
|
||||
|
||||
|
@ -298,12 +313,12 @@ class Functions
|
|||
|
||||
return $operator . $operand;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ERROR_TYPE
|
||||
* ERROR_TYPE.
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function errorType($value = '')
|
||||
|
@ -322,9 +337,10 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* IS_BLANK
|
||||
* IS_BLANK.
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isBlank($value = null)
|
||||
|
@ -337,9 +353,10 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* IS_ERR
|
||||
* IS_ERR.
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isErr($value = '')
|
||||
|
@ -350,9 +367,10 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* IS_ERROR
|
||||
* IS_ERROR.
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isError($value = '')
|
||||
|
@ -367,9 +385,10 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* IS_NA
|
||||
* IS_NA.
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNa($value = '')
|
||||
|
@ -380,9 +399,10 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* IS_EVEN
|
||||
* IS_EVEN.
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
*
|
||||
* @return string|bool
|
||||
*/
|
||||
public static function isEven($value = null)
|
||||
|
@ -399,9 +419,10 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* IS_ODD
|
||||
* IS_ODD.
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
*
|
||||
* @return string|bool
|
||||
*/
|
||||
public static function isOdd($value = null)
|
||||
|
@ -418,9 +439,10 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* IS_NUMBER
|
||||
* IS_NUMBER.
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNumber($value = null)
|
||||
|
@ -435,9 +457,10 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* IS_LOGICAL
|
||||
* IS_LOGICAL.
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isLogical($value = null)
|
||||
|
@ -448,9 +471,10 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* IS_TEXT
|
||||
* IS_TEXT.
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isText($value = null)
|
||||
|
@ -461,9 +485,10 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* IS_NONTEXT
|
||||
* IS_NONTEXT.
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNonText($value = null)
|
||||
|
@ -472,11 +497,13 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* N
|
||||
* N.
|
||||
*
|
||||
* Returns a value converted to a number
|
||||
*
|
||||
* @param value The value you want converted
|
||||
* @param null|mixed $value
|
||||
*
|
||||
* @return number N converts values listed in the following table
|
||||
* If value is or refers to N returns
|
||||
* A number That number
|
||||
|
@ -498,10 +525,10 @@ class Functions
|
|||
case 'integer':
|
||||
return $value;
|
||||
case 'boolean':
|
||||
return (integer) $value;
|
||||
return (int) $value;
|
||||
case 'string':
|
||||
// Errors
|
||||
if ((strlen($value) > 0) && ($value{0} == '#')) {
|
||||
if ((strlen($value) > 0) && ($value[0] == '#')) {
|
||||
return $value;
|
||||
}
|
||||
break;
|
||||
|
@ -511,11 +538,13 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* TYPE
|
||||
* TYPE.
|
||||
*
|
||||
* Returns a number that identifies the type of a value
|
||||
*
|
||||
* @param value The value you want tested
|
||||
* @param null|mixed $value
|
||||
*
|
||||
* @return number N converts values listed in the following table
|
||||
* If value is or refers to N returns
|
||||
* A number 1
|
||||
|
@ -551,7 +580,7 @@ class Functions
|
|||
return 64;
|
||||
} elseif (is_string($value)) {
|
||||
// Errors
|
||||
if ((strlen($value) > 0) && ($value{0} == '#')) {
|
||||
if ((strlen($value) > 0) && ($value[0] == '#')) {
|
||||
return 16;
|
||||
}
|
||||
|
||||
|
@ -562,9 +591,10 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* Convert a multi-dimensional array to a simple 1-dimensional array
|
||||
* Convert a multi-dimensional array to a simple 1-dimensional array.
|
||||
*
|
||||
* @param array $array Array to be flattened
|
||||
*
|
||||
* @return array Flattened array
|
||||
*/
|
||||
public static function flattenArray($array)
|
||||
|
@ -594,9 +624,10 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* Convert a multi-dimensional array to a simple 1-dimensional array, but retain an element of indexing
|
||||
* Convert a multi-dimensional array to a simple 1-dimensional array, but retain an element of indexing.
|
||||
*
|
||||
* @param array $array Array to be flattened
|
||||
*
|
||||
* @return array Flattened array
|
||||
*/
|
||||
public static function flattenArrayIndexed($array)
|
||||
|
@ -626,9 +657,10 @@ class Functions
|
|||
}
|
||||
|
||||
/**
|
||||
* Convert an array to a single scalar value by extracting the first element
|
||||
* Convert an array to a single scalar value by extracting the first element.
|
||||
*
|
||||
* @param mixed $value Array or scalar value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function flattenSingleValue($value = '')
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Calculation;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Logical
|
||||
{
|
||||
/**
|
||||
* TRUE
|
||||
* TRUE.
|
||||
*
|
||||
* Returns the boolean TRUE.
|
||||
*
|
||||
|
@ -34,6 +35,7 @@ class Logical
|
|||
* =TRUE()
|
||||
*
|
||||
* @category Logical Functions
|
||||
*
|
||||
* @return bool True
|
||||
*/
|
||||
public static function true()
|
||||
|
@ -42,7 +44,7 @@ class Logical
|
|||
}
|
||||
|
||||
/**
|
||||
* FALSE
|
||||
* FALSE.
|
||||
*
|
||||
* Returns the boolean FALSE.
|
||||
*
|
||||
|
@ -50,6 +52,7 @@ class Logical
|
|||
* =FALSE()
|
||||
*
|
||||
* @category Logical Functions
|
||||
*
|
||||
* @return bool False
|
||||
*/
|
||||
public static function false()
|
||||
|
@ -58,7 +61,7 @@ class Logical
|
|||
}
|
||||
|
||||
/**
|
||||
* LOGICAL_AND
|
||||
* LOGICAL_AND.
|
||||
*
|
||||
* Returns boolean TRUE if all its arguments are TRUE; returns FALSE if one or more argument is FALSE.
|
||||
*
|
||||
|
@ -74,8 +77,10 @@ class Logical
|
|||
* the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
|
||||
*
|
||||
* @category Logical Functions
|
||||
*
|
||||
* @param mixed $arg,... Data values
|
||||
* @return string|bool The logical AND of the arguments.
|
||||
*
|
||||
* @return string|bool the logical AND of the arguments
|
||||
*/
|
||||
public static function logicalAnd()
|
||||
{
|
||||
|
@ -113,7 +118,7 @@ class Logical
|
|||
}
|
||||
|
||||
/**
|
||||
* LOGICAL_OR
|
||||
* LOGICAL_OR.
|
||||
*
|
||||
* Returns boolean TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE.
|
||||
*
|
||||
|
@ -129,8 +134,10 @@ class Logical
|
|||
* the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
|
||||
*
|
||||
* @category Logical Functions
|
||||
*
|
||||
* @param mixed $arg,... Data values
|
||||
* @return string|bool The logical OR of the arguments.
|
||||
*
|
||||
* @return string|bool the logical OR of the arguments
|
||||
*/
|
||||
public static function logicalOr()
|
||||
{
|
||||
|
@ -168,7 +175,7 @@ class Logical
|
|||
}
|
||||
|
||||
/**
|
||||
* NOT
|
||||
* NOT.
|
||||
*
|
||||
* Returns the boolean inverse of the argument.
|
||||
*
|
||||
|
@ -183,8 +190,10 @@ class Logical
|
|||
* the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
|
||||
*
|
||||
* @category Logical Functions
|
||||
*
|
||||
* @param mixed $logical A value or expression that can be evaluated to TRUE or FALSE
|
||||
* @return bool|string The boolean inverse of the argument.
|
||||
*
|
||||
* @return bool|string the boolean inverse of the argument
|
||||
*/
|
||||
public static function NOT($logical = false)
|
||||
{
|
||||
|
@ -195,16 +204,16 @@ class Logical
|
|||
return false;
|
||||
} elseif (($logical == 'FALSE') || ($logical == \PhpOffice\PhpSpreadsheet\Calculation::getFALSE())) {
|
||||
return true;
|
||||
} else {
|
||||
return Functions::VALUE();
|
||||
}
|
||||
|
||||
return Functions::VALUE();
|
||||
}
|
||||
|
||||
return !$logical;
|
||||
}
|
||||
|
||||
/**
|
||||
* STATEMENT_IF
|
||||
* STATEMENT_IF.
|
||||
*
|
||||
* Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE.
|
||||
*
|
||||
|
@ -229,14 +238,16 @@ class Logical
|
|||
* ReturnIfFalse can be another formula.
|
||||
*
|
||||
* @category Logical Functions
|
||||
*
|
||||
* @param mixed $condition Condition to evaluate
|
||||
* @param mixed $returnIfTrue Value to return when condition is true
|
||||
* @param mixed $returnIfFalse Optional value to return when condition is false
|
||||
*
|
||||
* @return mixed The value of returnIfTrue or returnIfFalse determined by condition
|
||||
*/
|
||||
public static function statementIf($condition = true, $returnIfTrue = 0, $returnIfFalse = false)
|
||||
{
|
||||
$condition = (is_null($condition)) ? true : (boolean) Functions::flattenSingleValue($condition);
|
||||
$condition = (is_null($condition)) ? true : (bool) Functions::flattenSingleValue($condition);
|
||||
$returnIfTrue = (is_null($returnIfTrue)) ? 0 : Functions::flattenSingleValue($returnIfTrue);
|
||||
$returnIfFalse = (is_null($returnIfFalse)) ? false : Functions::flattenSingleValue($returnIfFalse);
|
||||
|
||||
|
@ -244,14 +255,16 @@ class Logical
|
|||
}
|
||||
|
||||
/**
|
||||
* IFERROR
|
||||
* IFERROR.
|
||||
*
|
||||
* Excel Function:
|
||||
* =IFERROR(testValue,errorpart)
|
||||
*
|
||||
* @category Logical Functions
|
||||
*
|
||||
* @param mixed $testValue Value to check, is also the value returned when no error
|
||||
* @param mixed $errorpart Value to return when testValue is an error condition
|
||||
*
|
||||
* @return mixed The value of errorpart or testValue determined by error condition
|
||||
*/
|
||||
public static function IFERROR($testValue = '', $errorpart = '')
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Calculation;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class LookupRef
|
||||
{
|
||||
/**
|
||||
* CELL_ADDRESS
|
||||
* CELL_ADDRESS.
|
||||
*
|
||||
* Creates a cell address as text, given specified row and column numbers.
|
||||
*
|
||||
|
@ -44,6 +45,12 @@ class LookupRef
|
|||
* TRUE or omitted CELL_ADDRESS returns an A1-style reference
|
||||
* FALSE CELL_ADDRESS returns an R1C1-style reference
|
||||
* @param sheetText Optional Name of worksheet to use
|
||||
* @param mixed $row
|
||||
* @param mixed $column
|
||||
* @param mixed $relativity
|
||||
* @param mixed $referenceStyle
|
||||
* @param mixed $sheetText
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function cellAddress($row, $column, $relativity = 1, $referenceStyle = true, $sheetText = '')
|
||||
|
@ -74,7 +81,7 @@ class LookupRef
|
|||
}
|
||||
|
||||
return $sheetText . $columnRelative . $column . $rowRelative . $row;
|
||||
} else {
|
||||
}
|
||||
if (($relativity == 2) || ($relativity == 4)) {
|
||||
$column = '[' . $column . ']';
|
||||
}
|
||||
|
@ -84,10 +91,9 @@ class LookupRef
|
|||
|
||||
return $sheetText . 'R' . $row . 'C' . $column;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* COLUMN
|
||||
* COLUMN.
|
||||
*
|
||||
* Returns the column number of the given cell reference
|
||||
* If the cell reference is a range of cells, COLUMN returns the column numbers of each column in the reference as a horizontal array.
|
||||
|
@ -98,6 +104,8 @@ class LookupRef
|
|||
* =COLUMN([cellAddress])
|
||||
*
|
||||
* @param cellAddress A reference to a range of cells for which you want the column numbers
|
||||
* @param null|mixed $cellAddress
|
||||
*
|
||||
* @return int or array of integer
|
||||
*/
|
||||
public static function COLUMN($cellAddress = null)
|
||||
|
@ -110,7 +118,7 @@ class LookupRef
|
|||
foreach ($cellAddress as $columnKey => $value) {
|
||||
$columnKey = preg_replace('/[^a-z]/i', '', $columnKey);
|
||||
|
||||
return (integer) \PhpOffice\PhpSpreadsheet\Cell::columnIndexFromString($columnKey);
|
||||
return (int) \PhpOffice\PhpSpreadsheet\Cell::columnIndexFromString($columnKey);
|
||||
}
|
||||
} else {
|
||||
if (strpos($cellAddress, '!') !== false) {
|
||||
|
@ -122,20 +130,19 @@ class LookupRef
|
|||
$endAddress = preg_replace('/[^a-z]/i', '', $endAddress);
|
||||
$returnValue = [];
|
||||
do {
|
||||
$returnValue[] = (integer) \PhpOffice\PhpSpreadsheet\Cell::columnIndexFromString($startAddress);
|
||||
$returnValue[] = (int) \PhpOffice\PhpSpreadsheet\Cell::columnIndexFromString($startAddress);
|
||||
} while ($startAddress++ != $endAddress);
|
||||
|
||||
return $returnValue;
|
||||
} else {
|
||||
}
|
||||
$cellAddress = preg_replace('/[^a-z]/i', '', $cellAddress);
|
||||
|
||||
return (integer) \PhpOffice\PhpSpreadsheet\Cell::columnIndexFromString($cellAddress);
|
||||
}
|
||||
return (int) \PhpOffice\PhpSpreadsheet\Cell::columnIndexFromString($cellAddress);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* COLUMNS
|
||||
* COLUMNS.
|
||||
*
|
||||
* Returns the number of columns in an array or reference.
|
||||
*
|
||||
|
@ -143,6 +150,8 @@ class LookupRef
|
|||
* =COLUMNS(cellAddress)
|
||||
*
|
||||
* @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of columns
|
||||
* @param null|mixed $cellAddress
|
||||
*
|
||||
* @return int The number of columns in cellAddress
|
||||
*/
|
||||
public static function COLUMNS($cellAddress = null)
|
||||
|
@ -159,13 +168,13 @@ class LookupRef
|
|||
|
||||
if ($isMatrix) {
|
||||
return $rows;
|
||||
} else {
|
||||
return $columns;
|
||||
}
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* ROW
|
||||
* ROW.
|
||||
*
|
||||
* Returns the row number of the given cell reference
|
||||
* If the cell reference is a range of cells, ROW returns the row numbers of each row in the reference as a vertical array.
|
||||
|
@ -176,6 +185,8 @@ class LookupRef
|
|||
* =ROW([cellAddress])
|
||||
*
|
||||
* @param cellAddress A reference to a range of cells for which you want the row numbers
|
||||
* @param null|mixed $cellAddress
|
||||
*
|
||||
* @return int or array of integer
|
||||
*/
|
||||
public static function ROW($cellAddress = null)
|
||||
|
@ -187,7 +198,7 @@ class LookupRef
|
|||
if (is_array($cellAddress)) {
|
||||
foreach ($cellAddress as $columnKey => $rowValue) {
|
||||
foreach ($rowValue as $rowKey => $cellValue) {
|
||||
return (integer) preg_replace('/[^0-9]/i', '', $rowKey);
|
||||
return (int) preg_replace('/[^0-9]/i', '', $rowKey);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -200,20 +211,19 @@ class LookupRef
|
|||
$endAddress = preg_replace('/[^0-9]/', '', $endAddress);
|
||||
$returnValue = [];
|
||||
do {
|
||||
$returnValue[][] = (integer) $startAddress;
|
||||
$returnValue[][] = (int) $startAddress;
|
||||
} while ($startAddress++ != $endAddress);
|
||||
|
||||
return $returnValue;
|
||||
} else {
|
||||
}
|
||||
list($cellAddress) = explode(':', $cellAddress);
|
||||
|
||||
return (integer) preg_replace('/[^0-9]/', '', $cellAddress);
|
||||
}
|
||||
return (int) preg_replace('/[^0-9]/', '', $cellAddress);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ROWS
|
||||
* ROWS.
|
||||
*
|
||||
* Returns the number of rows in an array or reference.
|
||||
*
|
||||
|
@ -221,6 +231,8 @@ class LookupRef
|
|||
* =ROWS(cellAddress)
|
||||
*
|
||||
* @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of rows
|
||||
* @param null|mixed $cellAddress
|
||||
*
|
||||
* @return int The number of rows in cellAddress
|
||||
*/
|
||||
public static function ROWS($cellAddress = null)
|
||||
|
@ -237,21 +249,23 @@ class LookupRef
|
|||
|
||||
if ($isMatrix) {
|
||||
return $columns;
|
||||
} else {
|
||||
return $rows;
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* HYPERLINK
|
||||
* HYPERLINK.
|
||||
*
|
||||
* Excel Function:
|
||||
* =HYPERLINK(linkURL,displayName)
|
||||
*
|
||||
* @category Logical Functions
|
||||
*
|
||||
* @param string $linkURL Value to check, is also the value returned when no error
|
||||
* @param string $displayName Value to return when testValue is an error condition
|
||||
* @param \PhpOffice\PhpSpreadsheet\Cell $pCell The cell to set the hyperlink in
|
||||
*
|
||||
* @return mixed The value of $displayName (or $linkURL if $displayName was blank)
|
||||
*/
|
||||
public static function HYPERLINK($linkURL = '', $displayName = null, \PhpOffice\PhpSpreadsheet\Cell $pCell = null)
|
||||
|
@ -277,7 +291,7 @@ class LookupRef
|
|||
}
|
||||
|
||||
/**
|
||||
* INDIRECT
|
||||
* INDIRECT.
|
||||
*
|
||||
* Returns the reference specified by a text string.
|
||||
* References are immediately evaluated to display their contents.
|
||||
|
@ -289,6 +303,7 @@ class LookupRef
|
|||
*
|
||||
* @param cellAddress $cellAddress The cell address of the current cell (containing this formula)
|
||||
* @param \PhpOffice\PhpSpreadsheet\Cell $pCell The current cell (containing this formula)
|
||||
*
|
||||
* @return mixed The cells referenced by cellAddress
|
||||
*
|
||||
* @todo Support for the optional a1 parameter introduced in Excel 2010
|
||||
|
@ -335,7 +350,7 @@ class LookupRef
|
|||
}
|
||||
|
||||
/**
|
||||
* OFFSET
|
||||
* OFFSET.
|
||||
*
|
||||
* Returns a reference to a range that is a specified number of rows and columns from a cell or range of cells.
|
||||
* The reference that is returned can be a single cell or a range of cells. You can specify the number of rows and
|
||||
|
@ -357,6 +372,12 @@ class LookupRef
|
|||
* starting reference).
|
||||
* @param height The height, in number of rows, that you want the returned reference to be. Height must be a positive number.
|
||||
* @param width The width, in number of columns, that you want the returned reference to be. Width must be a positive number.
|
||||
* @param null|mixed $cellAddress
|
||||
* @param mixed $rows
|
||||
* @param mixed $columns
|
||||
* @param null|mixed $height
|
||||
* @param null|mixed $width
|
||||
*
|
||||
* @return string A reference to a cell or range of cells
|
||||
*/
|
||||
public static function OFFSET($cellAddress = null, $rows = 0, $columns = 0, $height = null, $width = null)
|
||||
|
@ -429,7 +450,7 @@ class LookupRef
|
|||
}
|
||||
|
||||
/**
|
||||
* CHOOSE
|
||||
* CHOOSE.
|
||||
*
|
||||
* Uses lookup_value to return a value from the list of value arguments.
|
||||
* Use CHOOSE to select one of up to 254 values based on the lookup_value.
|
||||
|
@ -444,6 +465,7 @@ class LookupRef
|
|||
* Between 1 to 254 value arguments from which CHOOSE selects a value or an action to perform based on
|
||||
* index_num. The arguments can be numbers, cell references, defined names, formulas, functions, or
|
||||
* text.
|
||||
*
|
||||
* @return mixed The selected value
|
||||
*/
|
||||
public static function CHOOSE()
|
||||
|
@ -467,13 +489,13 @@ class LookupRef
|
|||
|
||||
if (is_array($chooseArgs[$chosenEntry])) {
|
||||
return Functions::flattenArray($chooseArgs[$chosenEntry]);
|
||||
} else {
|
||||
return $chooseArgs[$chosenEntry];
|
||||
}
|
||||
|
||||
return $chooseArgs[$chosenEntry];
|
||||
}
|
||||
|
||||
/**
|
||||
* MATCH
|
||||
* MATCH.
|
||||
*
|
||||
* The MATCH function searches for a specified item in a range of cells
|
||||
*
|
||||
|
@ -483,6 +505,10 @@ class LookupRef
|
|||
* @param lookup_value The value that you want to match in lookup_array
|
||||
* @param lookup_array The range of cells being searched
|
||||
* @param match_type The number -1, 0, or 1. -1 means above, 0 means exact match, 1 means below. If match_type is 1 or -1, the list has to be ordered.
|
||||
* @param mixed $lookup_value
|
||||
* @param mixed $lookup_array
|
||||
* @param mixed $match_type
|
||||
*
|
||||
* @return int The relative position of the found item
|
||||
*/
|
||||
public static function MATCH($lookup_value, $lookup_array, $match_type = 1)
|
||||
|
@ -547,29 +573,27 @@ class LookupRef
|
|||
if ($i < 1) {
|
||||
// 1st cell was already smaller than the lookup_value
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
// the previous cell was the match
|
||||
return $keySet[$i - 1] + 1;
|
||||
}
|
||||
} elseif (($match_type == 1) && ($lookupArrayValue >= $lookup_value)) {
|
||||
$i = array_search($i, $keySet);
|
||||
// if match_type is 1 <=> find the largest value that is less than or equal to lookup_value
|
||||
if ($i < 1) {
|
||||
// 1st cell was already bigger than the lookup_value
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
// the previous cell was the match
|
||||
return $keySet[$i - 1] + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// unsuccessful in finding a match, return #N/A error value
|
||||
return Functions::NA();
|
||||
}
|
||||
|
||||
/**
|
||||
* INDEX
|
||||
* INDEX.
|
||||
*
|
||||
* Uses an index to choose a value from a reference or array
|
||||
*
|
||||
|
@ -579,6 +603,10 @@ class LookupRef
|
|||
* @param range_array A range of cells or an array constant
|
||||
* @param row_num The row in array from which to return a value. If row_num is omitted, column_num is required.
|
||||
* @param column_num The column in array from which to return a value. If column_num is omitted, row_num is required.
|
||||
* @param mixed $arrayValues
|
||||
* @param mixed $rowNum
|
||||
* @param mixed $columnNum
|
||||
*
|
||||
* @return mixed the value of a specified cell or array of cells
|
||||
*/
|
||||
public static function INDEX($arrayValues, $rowNum = 0, $columnNum = 0)
|
||||
|
@ -628,12 +656,13 @@ class LookupRef
|
|||
}
|
||||
|
||||
/**
|
||||
* TRANSPOSE
|
||||
* TRANSPOSE.
|
||||
*
|
||||
* @param array $matrixData A matrix of values
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* Unlike the Excel TRANSPOSE function, which will only work on a single row or column, this function will transpose a full matrix.
|
||||
* Unlike the Excel TRANSPOSE function, which will only work on a single row or column, this function will transpose a full matrix
|
||||
*/
|
||||
public static function TRANSPOSE($matrixData)
|
||||
{
|
||||
|
@ -669,10 +698,16 @@ class LookupRef
|
|||
/**
|
||||
* VLOOKUP
|
||||
* The VLOOKUP function searches for value in the left-most column of lookup_array and returns the value in the same row based on the index_number.
|
||||
*
|
||||
* @param lookup_value The value that you want to match in lookup_array
|
||||
* @param lookup_array The range of cells being searched
|
||||
* @param index_number The column number in table_array from which the matching value must be returned. The first column is 1.
|
||||
* @param not_exact_match Determines if you are looking for an exact match based on lookup_value.
|
||||
* @param not_exact_match determines if you are looking for an exact match based on lookup_value
|
||||
* @param mixed $lookup_value
|
||||
* @param mixed $lookup_array
|
||||
* @param mixed $index_number
|
||||
* @param mixed $not_exact_match
|
||||
*
|
||||
* @return mixed The value of the found cell
|
||||
*/
|
||||
public static function VLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match = true)
|
||||
|
@ -689,17 +724,15 @@ class LookupRef
|
|||
// index_number must be less than or equal to the number of columns in lookup_array
|
||||
if ((!is_array($lookup_array)) || (empty($lookup_array))) {
|
||||
return Functions::REF();
|
||||
} else {
|
||||
}
|
||||
$f = array_keys($lookup_array);
|
||||
$firstRow = array_pop($f);
|
||||
if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) {
|
||||
return Functions::REF();
|
||||
} else {
|
||||
}
|
||||
$columnKeys = array_keys($lookup_array[$firstRow]);
|
||||
$returnColumn = $columnKeys[--$index_number];
|
||||
$firstColumn = array_shift($columnKeys);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$not_exact_match) {
|
||||
uasort($lookup_array, ['self', 'vlookupSort']);
|
||||
|
@ -723,11 +756,10 @@ class LookupRef
|
|||
if ((!$not_exact_match) && ($rowValue != $lookup_value)) {
|
||||
// if an exact match is required, we have what we need to return an appropriate response
|
||||
return Functions::NA();
|
||||
} else {
|
||||
}
|
||||
// otherwise return the appropriate value
|
||||
return $lookup_array[$rowNumber][$returnColumn];
|
||||
}
|
||||
}
|
||||
|
||||
return Functions::NA();
|
||||
}
|
||||
|
@ -735,10 +767,16 @@ class LookupRef
|
|||
/**
|
||||
* HLOOKUP
|
||||
* The HLOOKUP function searches for value in the top-most row of lookup_array and returns the value in the same column based on the index_number.
|
||||
*
|
||||
* @param lookup_value The value that you want to match in lookup_array
|
||||
* @param lookup_array The range of cells being searched
|
||||
* @param index_number The row number in table_array from which the matching value must be returned. The first row is 1.
|
||||
* @param not_exact_match Determines if you are looking for an exact match based on lookup_value.
|
||||
* @param not_exact_match determines if you are looking for an exact match based on lookup_value
|
||||
* @param mixed $lookup_value
|
||||
* @param mixed $lookup_array
|
||||
* @param mixed $index_number
|
||||
* @param mixed $not_exact_match
|
||||
*
|
||||
* @return mixed The value of the found cell
|
||||
*/
|
||||
public static function HLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match = true)
|
||||
|
@ -755,18 +793,16 @@ class LookupRef
|
|||
// index_number must be less than or equal to the number of columns in lookup_array
|
||||
if ((!is_array($lookup_array)) || (empty($lookup_array))) {
|
||||
return Functions::REF();
|
||||
} else {
|
||||
}
|
||||
$f = array_keys($lookup_array);
|
||||
$firstRow = array_pop($f);
|
||||
if ((!is_array($lookup_array[$firstRow])) || ($index_number - 1 > count($lookup_array[$firstRow]))) {
|
||||
return Functions::REF();
|
||||
} else {
|
||||
}
|
||||
$columnKeys = array_keys($lookup_array[$firstRow]);
|
||||
$firstkey = $f[0] - 1;
|
||||
$returnColumn = $firstkey + $index_number;
|
||||
$firstColumn = array_shift($f);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$not_exact_match) {
|
||||
$firstRowH = asort($lookup_array[$firstColumn]);
|
||||
|
@ -785,11 +821,10 @@ class LookupRef
|
|||
if ((!$not_exact_match) && ($rowValue != $lookup_value)) {
|
||||
// if an exact match is required, we have what we need to return an appropriate response
|
||||
return Functions::NA();
|
||||
} else {
|
||||
}
|
||||
// otherwise return the appropriate value
|
||||
return $lookup_array[$returnColumn][$rowNumber];
|
||||
}
|
||||
}
|
||||
|
||||
return Functions::NA();
|
||||
}
|
||||
|
@ -797,9 +832,14 @@ class LookupRef
|
|||
/**
|
||||
* LOOKUP
|
||||
* The LOOKUP function searches for value either from a one-row or one-column range or from an array.
|
||||
*
|
||||
* @param lookup_value The value that you want to match in lookup_array
|
||||
* @param lookup_vector The range of cells being searched
|
||||
* @param result_vector The column from which the matching value must be returned
|
||||
* @param mixed $lookup_value
|
||||
* @param mixed $lookup_vector
|
||||
* @param null|mixed $result_vector
|
||||
*
|
||||
* @return mixed The value of the found cell
|
||||
*/
|
||||
public static function LOOKUP($lookup_value, $lookup_vector, $result_vector = null)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Calculation;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -46,9 +47,9 @@ class MathTrig
|
|||
rsort($factorArray);
|
||||
|
||||
return $factorArray;
|
||||
} else {
|
||||
return [(integer) $value];
|
||||
}
|
||||
|
||||
return [(int) $value];
|
||||
}
|
||||
|
||||
private static function romanCut($num, $n)
|
||||
|
@ -57,7 +58,7 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* ATAN2
|
||||
* ATAN2.
|
||||
*
|
||||
* This function calculates the arc tangent of the two variables x and y. It is similar to
|
||||
* calculating the arc tangent of y ÷ x, except that the signs of both arguments are used
|
||||
|
@ -73,9 +74,11 @@ class MathTrig
|
|||
* ATAN2(xCoordinate,yCoordinate)
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
* @param float $xCoordinate The x-coordinate of the point.
|
||||
* @param float $yCoordinate The y-coordinate of the point.
|
||||
* @return float The inverse tangent of the specified x- and y-coordinates.
|
||||
*
|
||||
* @param float $xCoordinate the x-coordinate of the point
|
||||
* @param float $yCoordinate the y-coordinate of the point
|
||||
*
|
||||
* @return float the inverse tangent of the specified x- and y-coordinates
|
||||
*/
|
||||
public static function ATAN2($xCoordinate = null, $yCoordinate = null)
|
||||
{
|
||||
|
@ -101,7 +104,7 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* CEILING
|
||||
* CEILING.
|
||||
*
|
||||
* Returns number rounded up, away from zero, to the nearest multiple of significance.
|
||||
* For example, if you want to avoid using pennies in your prices and your product is
|
||||
|
@ -112,8 +115,10 @@ class MathTrig
|
|||
* CEILING(number[,significance])
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
* @param float $number The number you want to round.
|
||||
* @param float $significance The multiple to which you want to round.
|
||||
*
|
||||
* @param float $number the number you want to round
|
||||
* @param float $significance the multiple to which you want to round
|
||||
*
|
||||
* @return float Rounded Number
|
||||
*/
|
||||
public static function CEILING($number, $significance = null)
|
||||
|
@ -131,16 +136,16 @@ class MathTrig
|
|||
return 0.0;
|
||||
} elseif (self::SIGN($number) == self::SIGN($significance)) {
|
||||
return ceil($number / $significance) * $significance;
|
||||
} else {
|
||||
return Functions::NAN();
|
||||
}
|
||||
|
||||
return Functions::NAN();
|
||||
}
|
||||
|
||||
return Functions::VALUE();
|
||||
}
|
||||
|
||||
/**
|
||||
* COMBIN
|
||||
* COMBIN.
|
||||
*
|
||||
* Returns the number of combinations for a given number of items. Use COMBIN to
|
||||
* determine the total possible number of groups for a given number of items.
|
||||
|
@ -149,8 +154,10 @@ class MathTrig
|
|||
* COMBIN(numObjs,numInSet)
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
*
|
||||
* @param int $numObjs Number of different objects
|
||||
* @param int $numInSet Number of objects in each combination
|
||||
*
|
||||
* @return int Number of combinations
|
||||
*/
|
||||
public static function COMBIN($numObjs, $numInSet)
|
||||
|
@ -172,7 +179,7 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* EVEN
|
||||
* EVEN.
|
||||
*
|
||||
* Returns number rounded up to the nearest even integer.
|
||||
* You can use this function for processing items that come in twos. For example,
|
||||
|
@ -184,7 +191,9 @@ class MathTrig
|
|||
* EVEN(number)
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
*
|
||||
* @param float $number Number to round
|
||||
*
|
||||
* @return int Rounded Number
|
||||
*/
|
||||
public static function EVEN($number)
|
||||
|
@ -207,7 +216,7 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* FACT
|
||||
* FACT.
|
||||
*
|
||||
* Returns the factorial of a number.
|
||||
* The factorial of a number is equal to 1*2*3*...* number.
|
||||
|
@ -216,7 +225,9 @@ class MathTrig
|
|||
* FACT(factVal)
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
*
|
||||
* @param float $factVal Factorial Value
|
||||
*
|
||||
* @return int Factorial
|
||||
*/
|
||||
public static function FACT($factVal)
|
||||
|
@ -246,7 +257,7 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* FACTDOUBLE
|
||||
* FACTDOUBLE.
|
||||
*
|
||||
* Returns the double factorial of a number.
|
||||
*
|
||||
|
@ -254,7 +265,9 @@ class MathTrig
|
|||
* FACTDOUBLE(factVal)
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
*
|
||||
* @param float $factVal Factorial Value
|
||||
*
|
||||
* @return int Double Factorial
|
||||
*/
|
||||
public static function FACTDOUBLE($factVal)
|
||||
|
@ -279,7 +292,7 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* FLOOR
|
||||
* FLOOR.
|
||||
*
|
||||
* Rounds number down, toward zero, to the nearest multiple of significance.
|
||||
*
|
||||
|
@ -287,8 +300,10 @@ class MathTrig
|
|||
* FLOOR(number[,significance])
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
*
|
||||
* @param float $number Number to round
|
||||
* @param float $significance Significance
|
||||
*
|
||||
* @return float Rounded Number
|
||||
*/
|
||||
public static function FLOOR($number, $significance = null)
|
||||
|
@ -308,16 +323,16 @@ class MathTrig
|
|||
return 0.0;
|
||||
} elseif (self::SIGN($number) == self::SIGN($significance)) {
|
||||
return floor($number / $significance) * $significance;
|
||||
} else {
|
||||
return Functions::NAN();
|
||||
}
|
||||
|
||||
return Functions::NAN();
|
||||
}
|
||||
|
||||
return Functions::VALUE();
|
||||
}
|
||||
|
||||
/**
|
||||
* GCD
|
||||
* GCD.
|
||||
*
|
||||
* Returns the greatest common divisor of a series of numbers.
|
||||
* The greatest common divisor is the largest integer that divides both
|
||||
|
@ -327,7 +342,9 @@ class MathTrig
|
|||
* GCD(number1[,number2[, ...]])
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
*
|
||||
* @param mixed $arg,... Data values
|
||||
*
|
||||
* @return int Greatest Common Divisor
|
||||
*/
|
||||
public static function GCD()
|
||||
|
@ -377,7 +394,7 @@ class MathTrig
|
|||
}
|
||||
|
||||
return $returnValue;
|
||||
} else {
|
||||
}
|
||||
$keys = array_keys($mergedArray);
|
||||
$key = $keys[0];
|
||||
$value = $mergedArray[$key];
|
||||
|
@ -391,10 +408,9 @@ class MathTrig
|
|||
|
||||
return pow($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* INT
|
||||
* INT.
|
||||
*
|
||||
* Casts a floating point value to an integer
|
||||
*
|
||||
|
@ -402,7 +418,9 @@ class MathTrig
|
|||
* INT(number)
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
*
|
||||
* @param float $number Number to cast to an integer
|
||||
*
|
||||
* @return int Integer value
|
||||
*/
|
||||
public static function INT($number)
|
||||
|
@ -422,7 +440,7 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* LCM
|
||||
* LCM.
|
||||
*
|
||||
* Returns the lowest common multiplier of a series of numbers
|
||||
* The least common multiple is the smallest positive integer that is a multiple
|
||||
|
@ -433,7 +451,9 @@ class MathTrig
|
|||
* LCM(number1[,number2[, ...]])
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
*
|
||||
* @param mixed $arg,... Data values
|
||||
*
|
||||
* @return int Lowest Common Multiplier
|
||||
*/
|
||||
public static function LCM()
|
||||
|
@ -467,14 +487,14 @@ class MathTrig
|
|||
}
|
||||
}
|
||||
foreach ($allPoweredFactors as $allPoweredFactor) {
|
||||
$returnValue *= (integer) $allPoweredFactor;
|
||||
$returnValue *= (int) $allPoweredFactor;
|
||||
}
|
||||
|
||||
return $returnValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* LOG_BASE
|
||||
* LOG_BASE.
|
||||
*
|
||||
* Returns the logarithm of a number to a specified base. The default base is 10.
|
||||
*
|
||||
|
@ -482,8 +502,10 @@ class MathTrig
|
|||
* LOG(number[,base])
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
*
|
||||
* @param float $number The positive real number for which you want the logarithm
|
||||
* @param float $base The base of the logarithm. If base is omitted, it is assumed to be 10.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function logBase($number = null, $base = 10)
|
||||
|
@ -502,7 +524,7 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* MDETERM
|
||||
* MDETERM.
|
||||
*
|
||||
* Returns the matrix determinant of an array.
|
||||
*
|
||||
|
@ -510,7 +532,9 @@ class MathTrig
|
|||
* MDETERM(array)
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
*
|
||||
* @param array $matrixValues A matrix of values
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function MDETERM($matrixValues)
|
||||
|
@ -552,7 +576,7 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* MINVERSE
|
||||
* MINVERSE.
|
||||
*
|
||||
* Returns the inverse matrix for the matrix stored in an array.
|
||||
*
|
||||
|
@ -560,7 +584,9 @@ class MathTrig
|
|||
* MINVERSE(array)
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
*
|
||||
* @param array $matrixValues A matrix of values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function MINVERSE($matrixValues)
|
||||
|
@ -604,10 +630,11 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* MMULT
|
||||
* MMULT.
|
||||
*
|
||||
* @param array $matrixData1 A matrix of values
|
||||
* @param array $matrixData2 A matrix of values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function MMULT($matrixData1, $matrixData2)
|
||||
|
@ -665,10 +692,11 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* MOD
|
||||
* MOD.
|
||||
*
|
||||
* @param int $a Dividend
|
||||
* @param int $b Divisor
|
||||
*
|
||||
* @return int Remainder
|
||||
*/
|
||||
public static function MOD($a = 1, $b = 1)
|
||||
|
@ -688,12 +716,13 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* MROUND
|
||||
* MROUND.
|
||||
*
|
||||
* Rounds a number to the nearest multiple of a specified value
|
||||
*
|
||||
* @param float $number Number to round
|
||||
* @param int $multiple Multiple to which you want to round $number
|
||||
*
|
||||
* @return float Rounded Number
|
||||
*/
|
||||
public static function MROUND($number, $multiple)
|
||||
|
@ -718,11 +747,12 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* MULTINOMIAL
|
||||
* MULTINOMIAL.
|
||||
*
|
||||
* Returns the ratio of the factorial of a sum of values to the product of factorials.
|
||||
*
|
||||
* @param array of mixed Data Series
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function MULTINOMIAL()
|
||||
|
@ -754,11 +784,12 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* ODD
|
||||
* ODD.
|
||||
*
|
||||
* Returns number rounded up to the nearest odd integer.
|
||||
*
|
||||
* @param float $number Number to round
|
||||
*
|
||||
* @return int Rounded Number
|
||||
*/
|
||||
public static function ODD($number)
|
||||
|
@ -787,12 +818,13 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* POWER
|
||||
* POWER.
|
||||
*
|
||||
* Computes x raised to the power y.
|
||||
*
|
||||
* @param float $x
|
||||
* @param float $y
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function POWER($x = 0, $y = 2)
|
||||
|
@ -814,7 +846,7 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* PRODUCT
|
||||
* PRODUCT.
|
||||
*
|
||||
* PRODUCT returns the product of all the values and cells referenced in the argument list.
|
||||
*
|
||||
|
@ -822,7 +854,9 @@ class MathTrig
|
|||
* PRODUCT(value1[,value2[, ...]])
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
*
|
||||
* @param mixed $arg,... Data values
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function PRODUCT()
|
||||
|
@ -851,7 +885,7 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* QUOTIENT
|
||||
* QUOTIENT.
|
||||
*
|
||||
* QUOTIENT function returns the integer portion of a division. Numerator is the divided number
|
||||
* and denominator is the divisor.
|
||||
|
@ -860,7 +894,9 @@ class MathTrig
|
|||
* QUOTIENT(value1[,value2[, ...]])
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
*
|
||||
* @param mixed $arg,... Data values
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function QUOTIENT()
|
||||
|
@ -885,14 +921,15 @@ class MathTrig
|
|||
}
|
||||
|
||||
// Return
|
||||
return intval($returnValue);
|
||||
return (int) $returnValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* RAND
|
||||
* RAND.
|
||||
*
|
||||
* @param int $min Minimal value
|
||||
* @param int $max Maximal value
|
||||
*
|
||||
* @return int Random number
|
||||
*/
|
||||
public static function RAND($min = 0, $max = 0)
|
||||
|
@ -902,19 +939,19 @@ class MathTrig
|
|||
|
||||
if ($min == 0 && $max == 0) {
|
||||
return (mt_rand(0, 10000000)) / 10000000;
|
||||
} else {
|
||||
return mt_rand($min, $max);
|
||||
}
|
||||
|
||||
return mt_rand($min, $max);
|
||||
}
|
||||
|
||||
public static function ROMAN($aValue, $style = 0)
|
||||
{
|
||||
$aValue = Functions::flattenSingleValue($aValue);
|
||||
$style = (is_null($style)) ? 0 : (integer) Functions::flattenSingleValue($style);
|
||||
$style = (is_null($style)) ? 0 : (int) Functions::flattenSingleValue($style);
|
||||
if ((!is_numeric($aValue)) || ($aValue < 0) || ($aValue >= 4000)) {
|
||||
return Functions::VALUE();
|
||||
}
|
||||
$aValue = (integer) $aValue;
|
||||
$aValue = (int) $aValue;
|
||||
if ($aValue == 0) {
|
||||
return '';
|
||||
}
|
||||
|
@ -940,12 +977,13 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* ROUNDUP
|
||||
* ROUNDUP.
|
||||
*
|
||||
* Rounds a number up to a specified number of decimal places
|
||||
*
|
||||
* @param float $number Number to round
|
||||
* @param int $digits Number of digits to which you want to round $number
|
||||
*
|
||||
* @return float Rounded Number
|
||||
*/
|
||||
public static function ROUNDUP($number, $digits)
|
||||
|
@ -957,21 +995,22 @@ class MathTrig
|
|||
$significance = pow(10, (int) $digits);
|
||||
if ($number < 0.0) {
|
||||
return floor($number * $significance) / $significance;
|
||||
} else {
|
||||
return ceil($number * $significance) / $significance;
|
||||
}
|
||||
|
||||
return ceil($number * $significance) / $significance;
|
||||
}
|
||||
|
||||
return Functions::VALUE();
|
||||
}
|
||||
|
||||
/**
|
||||
* ROUNDDOWN
|
||||
* ROUNDDOWN.
|
||||
*
|
||||
* Rounds a number down to a specified number of decimal places
|
||||
*
|
||||
* @param float $number Number to round
|
||||
* @param int $digits Number of digits to which you want to round $number
|
||||
*
|
||||
* @return float Rounded Number
|
||||
*/
|
||||
public static function ROUNDDOWN($number, $digits)
|
||||
|
@ -983,16 +1022,16 @@ class MathTrig
|
|||
$significance = pow(10, (int) $digits);
|
||||
if ($number < 0.0) {
|
||||
return ceil($number * $significance) / $significance;
|
||||
} else {
|
||||
return floor($number * $significance) / $significance;
|
||||
}
|
||||
|
||||
return floor($number * $significance) / $significance;
|
||||
}
|
||||
|
||||
return Functions::VALUE();
|
||||
}
|
||||
|
||||
/**
|
||||
* SERIESSUM
|
||||
* SERIESSUM.
|
||||
*
|
||||
* Returns the sum of a power series
|
||||
*
|
||||
|
@ -1000,6 +1039,7 @@ class MathTrig
|
|||
* @param float $n Initial power to which you want to raise $x
|
||||
* @param float $m Step by which to increase $n for each term in the series
|
||||
* @param array of mixed Data Series
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function SERIESSUM()
|
||||
|
@ -1032,12 +1072,13 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* SIGN
|
||||
* SIGN.
|
||||
*
|
||||
* Determines the sign of a number. Returns 1 if the number is positive, zero (0)
|
||||
* if the number is 0, and -1 if the number is negative.
|
||||
*
|
||||
* @param float $number Number to round
|
||||
*
|
||||
* @return int sign value
|
||||
*/
|
||||
public static function SIGN($number)
|
||||
|
@ -1059,11 +1100,12 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* SQRTPI
|
||||
* SQRTPI.
|
||||
*
|
||||
* Returns the square root of (number * pi).
|
||||
*
|
||||
* @param float $number Number
|
||||
*
|
||||
* @return float Square Root of Number * Pi
|
||||
*/
|
||||
public static function SQRTPI($number)
|
||||
|
@ -1082,13 +1124,14 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* SUBTOTAL
|
||||
* SUBTOTAL.
|
||||
*
|
||||
* Returns a subtotal in a list or database.
|
||||
*
|
||||
* @param int the number 1 to 11 that specifies which function to
|
||||
* use in calculating subtotals within a list.
|
||||
* use in calculating subtotals within a list
|
||||
* @param array of mixed Data Series
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function SUBTOTAL()
|
||||
|
@ -1129,7 +1172,7 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* SUM
|
||||
* SUM.
|
||||
*
|
||||
* SUM computes the sum of all the values and cells referenced in the argument list.
|
||||
*
|
||||
|
@ -1137,7 +1180,9 @@ class MathTrig
|
|||
* SUM(value1[,value2[, ...]])
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
*
|
||||
* @param mixed $arg,... Data values
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function SUM()
|
||||
|
@ -1156,7 +1201,7 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* SUMIF
|
||||
* SUMIF.
|
||||
*
|
||||
* Counts the number of cells that contain numbers within the list of arguments
|
||||
*
|
||||
|
@ -1164,8 +1209,12 @@ class MathTrig
|
|||
* SUMIF(value1[,value2[, ...]],condition)
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
*
|
||||
* @param mixed $arg,... Data values
|
||||
* @param string $condition The criteria that defines which cells will be summed.
|
||||
* @param string $condition the criteria that defines which cells will be summed
|
||||
* @param mixed $aArgs
|
||||
* @param mixed $sumArgs
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function SUMIF($aArgs, $condition, $sumArgs = [])
|
||||
|
@ -1196,7 +1245,7 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* SUMIFS
|
||||
* SUMIFS.
|
||||
*
|
||||
* Counts the number of cells that contain numbers within the list of arguments
|
||||
*
|
||||
|
@ -1204,8 +1253,10 @@ class MathTrig
|
|||
* SUMIFS(value1[,value2[, ...]],condition)
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
*
|
||||
* @param mixed $arg,... Data values
|
||||
* @param string $condition The criteria that defines which cells will be summed.
|
||||
* @param string $condition the criteria that defines which cells will be summed
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function SUMIFS()
|
||||
|
@ -1244,13 +1295,15 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* SUMPRODUCT
|
||||
* SUMPRODUCT.
|
||||
*
|
||||
* Excel Function:
|
||||
* SUMPRODUCT(value1[,value2[, ...]])
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
*
|
||||
* @param mixed $arg,... Data values
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function SUMPRODUCT()
|
||||
|
@ -1285,7 +1338,7 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* SUMSQ
|
||||
* SUMSQ.
|
||||
*
|
||||
* SUMSQ returns the sum of the squares of the arguments
|
||||
*
|
||||
|
@ -1293,7 +1346,9 @@ class MathTrig
|
|||
* SUMSQ(value1[,value2[, ...]])
|
||||
*
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
*
|
||||
* @param mixed $arg,... Data values
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function SUMSQ()
|
||||
|
@ -1312,10 +1367,11 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* SUMX2MY2
|
||||
* SUMX2MY2.
|
||||
*
|
||||
* @param mixed[] $matrixData1 Matrix #1
|
||||
* @param mixed[] $matrixData2 Matrix #2
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function SUMX2MY2($matrixData1, $matrixData2)
|
||||
|
@ -1336,10 +1392,11 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* SUMX2PY2
|
||||
* SUMX2PY2.
|
||||
*
|
||||
* @param mixed[] $matrixData1 Matrix #1
|
||||
* @param mixed[] $matrixData2 Matrix #2
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function SUMX2PY2($matrixData1, $matrixData2)
|
||||
|
@ -1360,10 +1417,11 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* SUMXMY2
|
||||
* SUMXMY2.
|
||||
*
|
||||
* @param mixed[] $matrixData1 Matrix #1
|
||||
* @param mixed[] $matrixData2 Matrix #2
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function SUMXMY2($matrixData1, $matrixData2)
|
||||
|
@ -1384,12 +1442,13 @@ class MathTrig
|
|||
}
|
||||
|
||||
/**
|
||||
* TRUNC
|
||||
* TRUNC.
|
||||
*
|
||||
* Truncates value to the number of fractional digits by number_digits.
|
||||
*
|
||||
* @param float $value
|
||||
* @param int $digits
|
||||
*
|
||||
* @return float Truncated value
|
||||
*/
|
||||
public static function TRUNC($value = 0, $digits = 0)
|
||||
|
@ -1406,10 +1465,10 @@ class MathTrig
|
|||
// Truncate
|
||||
$adjust = pow(10, $digits);
|
||||
|
||||
if (($digits > 0) && (rtrim(intval((abs($value) - abs(intval($value))) * $adjust), '0') < $adjust / 10)) {
|
||||
if (($digits > 0) && (rtrim((int) ((abs($value) - abs((int) $value)) * $adjust), '0') < $adjust / 10)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
return (intval($value * $adjust)) / $adjust;
|
||||
return ((int) ($value * $adjust)) / $adjust;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Calculation;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -33,9 +34,10 @@ class TextData
|
|||
}
|
||||
|
||||
/**
|
||||
* CHARACTER
|
||||
* CHARACTER.
|
||||
*
|
||||
* @param string $character Value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function CHARACTER($character)
|
||||
|
@ -50,13 +52,14 @@ class TextData
|
|||
return iconv('UCS-4LE', 'UTF-8', pack('V', $character));
|
||||
}
|
||||
|
||||
return mb_convert_encoding('&#' . intval($character) . ';', 'UTF-8', 'HTML-ENTITIES');
|
||||
return mb_convert_encoding('&#' . (int) $character . ';', 'UTF-8', 'HTML-ENTITIES');
|
||||
}
|
||||
|
||||
/**
|
||||
* TRIMNONPRINTABLE
|
||||
* TRIMNONPRINTABLE.
|
||||
*
|
||||
* @param mixed $stringValue Value to check
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function TRIMNONPRINTABLE($stringValue = '')
|
||||
|
@ -79,9 +82,10 @@ class TextData
|
|||
}
|
||||
|
||||
/**
|
||||
* TRIMSPACES
|
||||
* TRIMSPACES.
|
||||
*
|
||||
* @param mixed $stringValue Value to check
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function TRIMSPACES($stringValue = '')
|
||||
|
@ -99,9 +103,10 @@ class TextData
|
|||
}
|
||||
|
||||
/**
|
||||
* ASCIICODE
|
||||
* ASCIICODE.
|
||||
*
|
||||
* @param string $characters Value
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function ASCIICODE($characters)
|
||||
|
@ -125,17 +130,16 @@ class TextData
|
|||
}
|
||||
|
||||
return self::unicodeToOrd($character);
|
||||
} else {
|
||||
}
|
||||
if (strlen($characters) > 0) {
|
||||
$character = substr($characters, 0, 1);
|
||||
}
|
||||
|
||||
return ord($character);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* CONCATENATE
|
||||
* CONCATENATE.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -160,7 +164,7 @@ class TextData
|
|||
}
|
||||
|
||||
/**
|
||||
* DOLLAR
|
||||
* DOLLAR.
|
||||
*
|
||||
* This function converts a number to text using currency format, with the decimals rounded to the specified place.
|
||||
* The format used is $#,##0.00_);($#,##0.00)..
|
||||
|
@ -169,6 +173,7 @@ class TextData
|
|||
* @param int $decimals The number of digits to display to the right of the decimal point.
|
||||
* If decimals is negative, number is rounded to the left of the decimal point.
|
||||
* If you omit decimals, it is assumed to be 2
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function DOLLAR($value = 0, $decimals = 2)
|
||||
|
@ -197,11 +202,12 @@ class TextData
|
|||
}
|
||||
|
||||
/**
|
||||
* SEARCHSENSITIVE
|
||||
* SEARCHSENSITIVE.
|
||||
*
|
||||
* @param string $needle The string to look for
|
||||
* @param string $haystack The string in which to look
|
||||
* @param int $offset Offset within $haystack
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function SEARCHSENSITIVE($needle, $haystack, $offset = 1)
|
||||
|
@ -234,11 +240,12 @@ class TextData
|
|||
}
|
||||
|
||||
/**
|
||||
* SEARCHINSENSITIVE
|
||||
* SEARCHINSENSITIVE.
|
||||
*
|
||||
* @param string $needle The string to look for
|
||||
* @param string $haystack The string in which to look
|
||||
* @param int $offset Offset within $haystack
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function SEARCHINSENSITIVE($needle, $haystack, $offset = 1)
|
||||
|
@ -271,11 +278,12 @@ class TextData
|
|||
}
|
||||
|
||||
/**
|
||||
* FIXEDFORMAT
|
||||
* FIXEDFORMAT.
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @param int $decimals
|
||||
* @param bool $no_commas
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = false)
|
||||
|
@ -302,10 +310,11 @@ class TextData
|
|||
}
|
||||
|
||||
/**
|
||||
* LEFT
|
||||
* LEFT.
|
||||
*
|
||||
* @param string $value Value
|
||||
* @param int $chars Number of characters
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function LEFT($value = '', $chars = 1)
|
||||
|
@ -323,17 +332,18 @@ class TextData
|
|||
|
||||
if (function_exists('mb_substr')) {
|
||||
return mb_substr($value, 0, $chars, 'UTF-8');
|
||||
} else {
|
||||
return substr($value, 0, $chars);
|
||||
}
|
||||
|
||||
return substr($value, 0, $chars);
|
||||
}
|
||||
|
||||
/**
|
||||
* MID
|
||||
* MID.
|
||||
*
|
||||
* @param string $value Value
|
||||
* @param int $start Start character
|
||||
* @param int $chars Number of characters
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function MID($value = '', $start = 1, $chars = null)
|
||||
|
@ -355,16 +365,17 @@ class TextData
|
|||
}
|
||||
if (function_exists('mb_substr')) {
|
||||
return mb_substr($value, --$start, $chars, 'UTF-8');
|
||||
} else {
|
||||
return substr($value, --$start, $chars);
|
||||
}
|
||||
|
||||
return substr($value, --$start, $chars);
|
||||
}
|
||||
|
||||
/**
|
||||
* RIGHT
|
||||
* RIGHT.
|
||||
*
|
||||
* @param string $value Value
|
||||
* @param int $chars Number of characters
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function RIGHT($value = '', $chars = 1)
|
||||
|
@ -382,15 +393,16 @@ class TextData
|
|||
|
||||
if ((function_exists('mb_substr')) && (function_exists('mb_strlen'))) {
|
||||
return mb_substr($value, mb_strlen($value, 'UTF-8') - $chars, $chars, 'UTF-8');
|
||||
} else {
|
||||
return substr($value, strlen($value) - $chars);
|
||||
}
|
||||
|
||||
return substr($value, strlen($value) - $chars);
|
||||
}
|
||||
|
||||
/**
|
||||
* STRINGLENGTH
|
||||
* STRINGLENGTH.
|
||||
*
|
||||
* @param string $value Value
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function STRINGLENGTH($value = '')
|
||||
|
@ -403,17 +415,18 @@ class TextData
|
|||
|
||||
if (function_exists('mb_strlen')) {
|
||||
return mb_strlen($value, 'UTF-8');
|
||||
} else {
|
||||
return strlen($value);
|
||||
}
|
||||
|
||||
return strlen($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* LOWERCASE
|
||||
* LOWERCASE.
|
||||
*
|
||||
* Converts a string value to upper case.
|
||||
*
|
||||
* @param string $mixedCaseString
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function LOWERCASE($mixedCaseString)
|
||||
|
@ -428,11 +441,12 @@ class TextData
|
|||
}
|
||||
|
||||
/**
|
||||
* UPPERCASE
|
||||
* UPPERCASE.
|
||||
*
|
||||
* Converts a string value to upper case.
|
||||
*
|
||||
* @param string $mixedCaseString
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function UPPERCASE($mixedCaseString)
|
||||
|
@ -447,11 +461,12 @@ class TextData
|
|||
}
|
||||
|
||||
/**
|
||||
* PROPERCASE
|
||||
* PROPERCASE.
|
||||
*
|
||||
* Converts a string value to upper case.
|
||||
*
|
||||
* @param string $mixedCaseString
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function PROPERCASE($mixedCaseString)
|
||||
|
@ -466,12 +481,13 @@ class TextData
|
|||
}
|
||||
|
||||
/**
|
||||
* REPLACE
|
||||
* REPLACE.
|
||||
*
|
||||
* @param string $oldText String to modify
|
||||
* @param int $start Start character
|
||||
* @param int $chars Number of characters
|
||||
* @param string $newText String to replace in defined position
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function REPLACE($oldText, $start, $chars, $newText)
|
||||
|
@ -488,12 +504,13 @@ class TextData
|
|||
}
|
||||
|
||||
/**
|
||||
* SUBSTITUTE
|
||||
* SUBSTITUTE.
|
||||
*
|
||||
* @param string $text Value
|
||||
* @param string $fromText From Value
|
||||
* @param string $toText To Value
|
||||
* @param int $instance Instance Number
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function SUBSTITUTE($text = '', $fromText = '', $toText = '', $instance = 0)
|
||||
|
@ -506,10 +523,10 @@ class TextData
|
|||
if ($instance == 0) {
|
||||
if (function_exists('mb_str_replace')) {
|
||||
return mb_str_replace($fromText, $toText, $text);
|
||||
} else {
|
||||
}
|
||||
|
||||
return str_replace($fromText, $toText, $text);
|
||||
}
|
||||
} else {
|
||||
$pos = -1;
|
||||
while ($instance > 0) {
|
||||
if (function_exists('mb_strpos')) {
|
||||
|
@ -525,19 +542,19 @@ class TextData
|
|||
if ($pos !== false) {
|
||||
if (function_exists('mb_strlen')) {
|
||||
return self::REPLACE($text, ++$pos, mb_strlen($fromText, 'UTF-8'), $toText);
|
||||
} else {
|
||||
}
|
||||
|
||||
return self::REPLACE($text, ++$pos, strlen($fromText), $toText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* RETURNSTRING
|
||||
* RETURNSTRING.
|
||||
*
|
||||
* @param mixed $testValue Value to check
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public static function RETURNSTRING($testValue = '')
|
||||
|
@ -552,10 +569,11 @@ class TextData
|
|||
}
|
||||
|
||||
/**
|
||||
* TEXTFORMAT
|
||||
* TEXTFORMAT.
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @param string $format Format mask to use
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function TEXTFORMAT($value, $format)
|
||||
|
@ -571,9 +589,10 @@ class TextData
|
|||
}
|
||||
|
||||
/**
|
||||
* VALUE
|
||||
* VALUE.
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function VALUE($value = '')
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Calculation\Token;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,27 +20,28 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Token;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Stack
|
||||
{
|
||||
/**
|
||||
* The parser stack for formulae
|
||||
* The parser stack for formulae.
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
private $stack = [];
|
||||
|
||||
/**
|
||||
* Count of entries in the parser stack
|
||||
* Count of entries in the parser stack.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $count = 0;
|
||||
|
||||
/**
|
||||
* Return the number of entries on the stack
|
||||
* Return the number of entries on the stack.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
@ -50,7 +51,7 @@ class Stack
|
|||
}
|
||||
|
||||
/**
|
||||
* Push a new entry onto the stack
|
||||
* Push a new entry onto the stack.
|
||||
*
|
||||
* @param mixed $type
|
||||
* @param mixed $value
|
||||
|
@ -72,7 +73,7 @@ class Stack
|
|||
}
|
||||
|
||||
/**
|
||||
* Pop the last entry from the stack
|
||||
* Pop the last entry from the stack.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
@ -86,9 +87,10 @@ class Stack
|
|||
}
|
||||
|
||||
/**
|
||||
* Return an entry from the stack without removing it
|
||||
* Return an entry from the stack without removing it.
|
||||
*
|
||||
* @param int $n number indicating how far back in the stack we want to look
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function last($n = 1)
|
||||
|
@ -101,7 +103,7 @@ class Stack
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear the stack
|
||||
* Clear the stack.
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,27 +20,28 @@ namespace PhpOffice\PhpSpreadsheet;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Cell
|
||||
{
|
||||
/**
|
||||
* Default range variable constant
|
||||
* Default range variable constant.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const DEFAULT_RANGE = 'A1:A1';
|
||||
|
||||
/**
|
||||
* Value binder to use
|
||||
* Value binder to use.
|
||||
*
|
||||
* @var Cell\IValueBinder
|
||||
*/
|
||||
private static $valueBinder;
|
||||
|
||||
/**
|
||||
* Value of the cell
|
||||
* Value of the cell.
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
|
@ -59,33 +60,33 @@ class Cell
|
|||
private $calculatedValue;
|
||||
|
||||
/**
|
||||
* Type of the cell data
|
||||
* Type of the cell data.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $dataType;
|
||||
|
||||
/**
|
||||
* Parent worksheet
|
||||
* Parent worksheet.
|
||||
*
|
||||
* @var CachedObjectStorage\CacheBase
|
||||
*/
|
||||
private $parent;
|
||||
|
||||
/**
|
||||
* Index to cellXf
|
||||
* Index to cellXf.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $xfIndex = 0;
|
||||
|
||||
/**
|
||||
* Attributes of the formula
|
||||
* Attributes of the formula.
|
||||
*/
|
||||
private $formulaAttributes;
|
||||
|
||||
/**
|
||||
* Send notification to the cache controller
|
||||
* Send notification to the cache controller.
|
||||
**/
|
||||
public function notifyCacheController()
|
||||
{
|
||||
|
@ -105,11 +106,12 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a new Cell
|
||||
* Create a new Cell.
|
||||
*
|
||||
* @param mixed $pValue
|
||||
* @param string $pDataType
|
||||
* @param Worksheet $pSheet
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct($pValue = null, $pDataType = null, Worksheet $pSheet = null)
|
||||
|
@ -132,7 +134,7 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Get cell coordinate column
|
||||
* Get cell coordinate column.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -142,7 +144,7 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Get cell coordinate row
|
||||
* Get cell coordinate row.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
@ -152,7 +154,7 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Get cell coordinate
|
||||
* Get cell coordinate.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -162,7 +164,7 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Get cell value
|
||||
* Get cell value.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
@ -172,7 +174,7 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Get cell value with formatting
|
||||
* Get cell value with formatting.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -186,12 +188,14 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Set cell value
|
||||
* Set cell value.
|
||||
*
|
||||
* Sets the value for a cell, automatically determining the datatype using the value binder
|
||||
*
|
||||
* @param mixed $pValue Value
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return Cell
|
||||
*/
|
||||
public function setValue($pValue = null)
|
||||
|
@ -204,11 +208,13 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the value binder)
|
||||
* Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the value binder).
|
||||
*
|
||||
* @param mixed $pValue Value
|
||||
* @param string $pDataType Explicit data type
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return Cell
|
||||
*/
|
||||
public function setValueExplicit($pValue = null, $pDataType = Cell\DataType::TYPE_STRING)
|
||||
|
@ -251,12 +257,14 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Get calculated cell value
|
||||
* Get calculated cell value.
|
||||
*
|
||||
* @deprecated Since version 1.7.8 for planned changes to cell for array formula handling
|
||||
*
|
||||
* @param bool $resetLog Whether the calculation engine logger should be reset or not
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCalculatedValue($resetLog = true)
|
||||
|
@ -295,9 +303,10 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Set old calculated value (cached)
|
||||
* Set old calculated value (cached).
|
||||
*
|
||||
* @param mixed $pValue Value
|
||||
*
|
||||
* @return Cell
|
||||
*/
|
||||
public function setCalculatedValue($pValue = null)
|
||||
|
@ -325,7 +334,7 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Get cell data type
|
||||
* Get cell data type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -335,9 +344,10 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Set cell data type
|
||||
* Set cell data type.
|
||||
*
|
||||
* @param string $pDataType
|
||||
*
|
||||
* @return Cell
|
||||
*/
|
||||
public function setDataType($pDataType = Cell\DataType::TYPE_STRING)
|
||||
|
@ -351,7 +361,7 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Identify if the cell contains a formula
|
||||
* Identify if the cell contains a formula.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -364,6 +374,7 @@ class Cell
|
|||
* Does this cell contain Data validation rules?
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasDataValidation()
|
||||
|
@ -376,9 +387,10 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Data validation rules
|
||||
* Get Data validation rules.
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return Cell\DataValidation
|
||||
*/
|
||||
public function getDataValidation()
|
||||
|
@ -391,10 +403,12 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Data validation rules
|
||||
* Set Data validation rules.
|
||||
*
|
||||
* @param Cell\DataValidation $pDataValidation
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return Cell
|
||||
*/
|
||||
public function setDataValidation(Cell\DataValidation $pDataValidation = null)
|
||||
|
@ -412,6 +426,7 @@ class Cell
|
|||
* Does this cell contain a Hyperlink?
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasHyperlink()
|
||||
|
@ -424,9 +439,10 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Hyperlink
|
||||
* Get Hyperlink.
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return Cell\Hyperlink
|
||||
*/
|
||||
public function getHyperlink()
|
||||
|
@ -439,10 +455,12 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Hyperlink
|
||||
* Set Hyperlink.
|
||||
*
|
||||
* @param Cell\Hyperlink $pHyperlink
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return Cell
|
||||
*/
|
||||
public function setHyperlink(Cell\Hyperlink $pHyperlink = null)
|
||||
|
@ -457,7 +475,7 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Get parent worksheet
|
||||
* Get parent worksheet.
|
||||
*
|
||||
* @return CachedObjectStorage\CacheBase
|
||||
*/
|
||||
|
@ -467,7 +485,7 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Get parent worksheet
|
||||
* Get parent worksheet.
|
||||
*
|
||||
* @return Worksheet
|
||||
*/
|
||||
|
@ -477,17 +495,17 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Is this cell in a merge range
|
||||
* Is this cell in a merge range.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isInMergeRange()
|
||||
{
|
||||
return (boolean) $this->getMergeRange();
|
||||
return (bool) $this->getMergeRange();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this cell the master (top left cell) in a merge range (that holds the actual data value)
|
||||
* Is this cell the master (top left cell) in a merge range (that holds the actual data value).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -505,7 +523,7 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* If this cell is in a merge range, then return the range
|
||||
* If this cell is in a merge range, then return the range.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -521,7 +539,7 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Get cell style
|
||||
* Get cell style.
|
||||
*
|
||||
* @return Style
|
||||
*/
|
||||
|
@ -531,9 +549,10 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Re-bind parent
|
||||
* Re-bind parent.
|
||||
*
|
||||
* @param Worksheet $parent
|
||||
*
|
||||
* @return Cell
|
||||
*/
|
||||
public function rebindParent(Worksheet $parent)
|
||||
|
@ -547,6 +566,7 @@ class Cell
|
|||
* Is cell in a specific range?
|
||||
*
|
||||
* @param string $pRange Cell range (e.g. A1:A1)
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isInRange($pRange = 'A1:A1')
|
||||
|
@ -563,10 +583,12 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Coordinate from string
|
||||
* Coordinate from string.
|
||||
*
|
||||
* @param string $pCoordinateString
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return string[] Array containing column and row (indexes 0 and 1)
|
||||
*/
|
||||
public static function coordinateFromString($pCoordinateString = 'A1')
|
||||
|
@ -583,11 +605,13 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Make string row, column or cell coordinate absolute
|
||||
* Make string row, column or cell coordinate absolute.
|
||||
*
|
||||
* @param string $pCoordinateString e.g. 'A' or '1' or 'A1'
|
||||
* Note that this value can be a row or column reference as well as a cell reference
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return string Absolute coordinate e.g. '$A' or '$1' or '$A$1'
|
||||
*/
|
||||
public static function absoluteReference($pCoordinateString = 'A1')
|
||||
|
@ -617,10 +641,12 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Make string coordinate absolute
|
||||
* Make string coordinate absolute.
|
||||
*
|
||||
* @param string $pCoordinateString e.g. 'A1'
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return string Absolute coordinate e.g. '$A$1'
|
||||
*/
|
||||
public static function absoluteCoordinate($pCoordinateString = 'A1')
|
||||
|
@ -648,9 +674,10 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Split range into coordinate strings
|
||||
* Split range into coordinate strings.
|
||||
*
|
||||
* @param string $pRange e.g. 'B4:D9' or 'B4:D9,H2:O11' or 'B4'
|
||||
*
|
||||
* @return array Array containg one or more arrays containing one or two coordinate strings
|
||||
* e.g. array('B4','D9') or array(array('B4','D9'),array('H2','O11'))
|
||||
* or array('B4')
|
||||
|
@ -672,10 +699,12 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Build range from coordinate strings
|
||||
* Build range from coordinate strings.
|
||||
*
|
||||
* @param array $pRange Array containg one or more arrays containing one or two coordinate strings
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return string String representation of $pRange
|
||||
*/
|
||||
public static function buildRange($pRange)
|
||||
|
@ -697,9 +726,10 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Calculate range boundaries
|
||||
* Calculate range boundaries.
|
||||
*
|
||||
* @param string $pRange Cell range (e.g. A1:A1)
|
||||
*
|
||||
* @return array Range coordinates array(Start Cell, End Cell)
|
||||
* where Start Cell and End Cell are arrays (Column Number, Row Number)
|
||||
*/
|
||||
|
@ -732,9 +762,10 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Calculate range dimension
|
||||
* Calculate range dimension.
|
||||
*
|
||||
* @param string $pRange Cell range (e.g. A1:A1)
|
||||
*
|
||||
* @return array Range dimension (width, height)
|
||||
*/
|
||||
public static function rangeDimension($pRange = 'A1:A1')
|
||||
|
@ -746,9 +777,10 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Calculate range boundaries
|
||||
* Calculate range boundaries.
|
||||
*
|
||||
* @param string $pRange Cell range (e.g. A1:A1)
|
||||
*
|
||||
* @return array Range coordinates array(Start Cell, End Cell)
|
||||
* where Start Cell and End Cell are arrays (Column ID, Row Number)
|
||||
*/
|
||||
|
@ -773,9 +805,10 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Column index from string
|
||||
* Column index from string.
|
||||
*
|
||||
* @param string $pString
|
||||
*
|
||||
* @return int Column index (base 1 !!!)
|
||||
*/
|
||||
public static function columnIndexFromString($pString = 'A')
|
||||
|
@ -800,28 +833,29 @@ class Cell
|
|||
|
||||
// We also use the language construct isset() rather than the more costly strlen() function to match the length of $pString
|
||||
// for improved performance
|
||||
if (isset($pString{0})) {
|
||||
if (!isset($pString{1})) {
|
||||
if (isset($pString[0])) {
|
||||
if (!isset($pString[1])) {
|
||||
$_indexCache[$pString] = $_columnLookup[$pString];
|
||||
|
||||
return $_indexCache[$pString];
|
||||
} elseif (!isset($pString{2})) {
|
||||
$_indexCache[$pString] = $_columnLookup[$pString{0}] * 26 + $_columnLookup[$pString{1}];
|
||||
} elseif (!isset($pString[2])) {
|
||||
$_indexCache[$pString] = $_columnLookup[$pString[0]] * 26 + $_columnLookup[$pString[1]];
|
||||
|
||||
return $_indexCache[$pString];
|
||||
} elseif (!isset($pString{3})) {
|
||||
$_indexCache[$pString] = $_columnLookup[$pString{0}] * 676 + $_columnLookup[$pString{1}] * 26 + $_columnLookup[$pString{2}];
|
||||
} elseif (!isset($pString[3])) {
|
||||
$_indexCache[$pString] = $_columnLookup[$pString[0]] * 676 + $_columnLookup[$pString[1]] * 26 + $_columnLookup[$pString[2]];
|
||||
|
||||
return $_indexCache[$pString];
|
||||
}
|
||||
}
|
||||
throw new Exception('Column string index can not be ' . ((isset($pString{0})) ? 'longer than 3 characters' : 'empty'));
|
||||
throw new Exception('Column string index can not be ' . ((isset($pString[0])) ? 'longer than 3 characters' : 'empty'));
|
||||
}
|
||||
|
||||
/**
|
||||
* String from columnindex
|
||||
* String from columnindex.
|
||||
*
|
||||
* @param int $pColumnIndex Column index (base 0 !!!)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function stringFromColumnIndex($pColumnIndex = 0)
|
||||
|
@ -849,9 +883,10 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Extract all cell references in range
|
||||
* Extract all cell references in range.
|
||||
*
|
||||
* @param string $pRange Range (e.g. A1 or A1:C10 or A1:E10 A20:E25)
|
||||
*
|
||||
* @return array Array containing single cell references
|
||||
*/
|
||||
public static function extractAllCellReferencesInRange($pRange = 'A1')
|
||||
|
@ -912,10 +947,11 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Compare 2 cells
|
||||
* Compare 2 cells.
|
||||
*
|
||||
* @param Cell $a Cell a
|
||||
* @param Cell $b Cell b
|
||||
*
|
||||
* @return int Result of comparison (always -1 or 1, never zero!)
|
||||
*/
|
||||
public static function compareCells(Cell $a, Cell $b)
|
||||
|
@ -926,13 +962,13 @@ class Cell
|
|||
return 1;
|
||||
} elseif (self::columnIndexFromString($a->getColumn()) < self::columnIndexFromString($b->getColumn())) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value binder to use
|
||||
* Get value binder to use.
|
||||
*
|
||||
* @return Cell\IValueBinder
|
||||
*/
|
||||
|
@ -946,9 +982,10 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Set value binder to use
|
||||
* Set value binder to use.
|
||||
*
|
||||
* @param Cell\IValueBinder $binder
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function setValueBinder(Cell\IValueBinder $binder = null)
|
||||
|
@ -976,7 +1013,7 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Get index to cellXf
|
||||
* Get index to cellXf.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
@ -986,9 +1023,10 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Set index to cellXf
|
||||
* Set index to cellXf.
|
||||
*
|
||||
* @param int $pValue
|
||||
*
|
||||
* @return Cell
|
||||
*/
|
||||
public function setXfIndex($pValue = 0)
|
||||
|
@ -1000,6 +1038,8 @@ class Cell
|
|||
|
||||
/**
|
||||
* @deprecated Since version 1.7.8 for planned changes to cell for array formula handling
|
||||
*
|
||||
* @param mixed $pAttributes
|
||||
*/
|
||||
public function setFormulaAttributes($pAttributes)
|
||||
{
|
||||
|
@ -1017,7 +1057,7 @@ class Cell
|
|||
}
|
||||
|
||||
/**
|
||||
* Convert to string
|
||||
* Convert to string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Cell;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,16 +20,18 @@ namespace PhpOffice\PhpSpreadsheet\Cell;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class AdvancedValueBinder extends DefaultValueBinder implements IValueBinder
|
||||
{
|
||||
/**
|
||||
* Bind value to a cell
|
||||
* Bind value to a cell.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to bind value to
|
||||
* @param mixed $value Value to bind in cell
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function bindValue(\PhpOffice\PhpSpreadsheet\Cell $cell, $value = null)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Cell;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Cell;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -36,7 +37,7 @@ class DataType
|
|||
const TYPE_ERROR = 'e';
|
||||
|
||||
/**
|
||||
* List of error codes
|
||||
* List of error codes.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
@ -51,7 +52,7 @@ class DataType
|
|||
];
|
||||
|
||||
/**
|
||||
* Get list of error codes
|
||||
* Get list of error codes.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
@ -61,9 +62,11 @@ class DataType
|
|||
}
|
||||
|
||||
/**
|
||||
* Check a string that it satisfies Excel requirements
|
||||
* Check a string that it satisfies Excel requirements.
|
||||
*
|
||||
* @param mixed Value to sanitize to an Excel string
|
||||
* @param null|mixed $pValue
|
||||
*
|
||||
* @return mixed Sanitized value
|
||||
*/
|
||||
public static function checkString($pValue = null)
|
||||
|
@ -83,9 +86,11 @@ class DataType
|
|||
}
|
||||
|
||||
/**
|
||||
* Check a value that it is a valid error code
|
||||
* Check a value that it is a valid error code.
|
||||
*
|
||||
* @param mixed Value to sanitize to an Excel error code
|
||||
* @param null|mixed $pValue
|
||||
*
|
||||
* @return string Sanitized value
|
||||
*/
|
||||
public static function checkErrorCode($pValue = null)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Cell;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Cell;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -51,105 +52,105 @@ class DataValidation
|
|||
const OPERATOR_NOTEQUAL = 'notEqual';
|
||||
|
||||
/**
|
||||
* Formula 1
|
||||
* Formula 1.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $formula1 = '';
|
||||
|
||||
/**
|
||||
* Formula 2
|
||||
* Formula 2.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $formula2 = '';
|
||||
|
||||
/**
|
||||
* Type
|
||||
* Type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $type = self::TYPE_NONE;
|
||||
|
||||
/**
|
||||
* Error style
|
||||
* Error style.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $errorStyle = self::STYLE_STOP;
|
||||
|
||||
/**
|
||||
* Operator
|
||||
* Operator.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $operator = '';
|
||||
|
||||
/**
|
||||
* Allow Blank
|
||||
* Allow Blank.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $allowBlank = false;
|
||||
|
||||
/**
|
||||
* Show DropDown
|
||||
* Show DropDown.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $showDropDown = false;
|
||||
|
||||
/**
|
||||
* Show InputMessage
|
||||
* Show InputMessage.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $showInputMessage = false;
|
||||
|
||||
/**
|
||||
* Show ErrorMessage
|
||||
* Show ErrorMessage.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $showErrorMessage = false;
|
||||
|
||||
/**
|
||||
* Error title
|
||||
* Error title.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $errorTitle = '';
|
||||
|
||||
/**
|
||||
* Error
|
||||
* Error.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $error = '';
|
||||
|
||||
/**
|
||||
* Prompt title
|
||||
* Prompt title.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $promptTitle = '';
|
||||
|
||||
/**
|
||||
* Prompt
|
||||
* Prompt.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $prompt = '';
|
||||
|
||||
/**
|
||||
* Create a new DataValidation
|
||||
* Create a new DataValidation.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Formula 1
|
||||
* Get Formula 1.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -159,9 +160,10 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Formula 1
|
||||
* Set Formula 1.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return DataValidation
|
||||
*/
|
||||
public function setFormula1($value = '')
|
||||
|
@ -172,7 +174,7 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Formula 2
|
||||
* Get Formula 2.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -182,9 +184,10 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Formula 2
|
||||
* Set Formula 2.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return DataValidation
|
||||
*/
|
||||
public function setFormula2($value = '')
|
||||
|
@ -195,7 +198,7 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Type
|
||||
* Get Type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -205,9 +208,10 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Type
|
||||
* Set Type.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return DataValidation
|
||||
*/
|
||||
public function setType($value = self::TYPE_NONE)
|
||||
|
@ -218,7 +222,7 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Error style
|
||||
* Get Error style.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -228,9 +232,10 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Error style
|
||||
* Set Error style.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return DataValidation
|
||||
*/
|
||||
public function setErrorStyle($value = self::STYLE_STOP)
|
||||
|
@ -241,7 +246,7 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Operator
|
||||
* Get Operator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -251,9 +256,10 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Operator
|
||||
* Set Operator.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return DataValidation
|
||||
*/
|
||||
public function setOperator($value = '')
|
||||
|
@ -264,7 +270,7 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Allow Blank
|
||||
* Get Allow Blank.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -274,9 +280,10 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Allow Blank
|
||||
* Set Allow Blank.
|
||||
*
|
||||
* @param bool $value
|
||||
*
|
||||
* @return DataValidation
|
||||
*/
|
||||
public function setAllowBlank($value = false)
|
||||
|
@ -287,7 +294,7 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Show DropDown
|
||||
* Get Show DropDown.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -297,9 +304,10 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Show DropDown
|
||||
* Set Show DropDown.
|
||||
*
|
||||
* @param bool $value
|
||||
*
|
||||
* @return DataValidation
|
||||
*/
|
||||
public function setShowDropDown($value = false)
|
||||
|
@ -310,7 +318,7 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Show InputMessage
|
||||
* Get Show InputMessage.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -320,9 +328,10 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Show InputMessage
|
||||
* Set Show InputMessage.
|
||||
*
|
||||
* @param bool $value
|
||||
*
|
||||
* @return DataValidation
|
||||
*/
|
||||
public function setShowInputMessage($value = false)
|
||||
|
@ -333,7 +342,7 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Show ErrorMessage
|
||||
* Get Show ErrorMessage.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -343,9 +352,10 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Show ErrorMessage
|
||||
* Set Show ErrorMessage.
|
||||
*
|
||||
* @param bool $value
|
||||
*
|
||||
* @return DataValidation
|
||||
*/
|
||||
public function setShowErrorMessage($value = false)
|
||||
|
@ -356,7 +366,7 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Error title
|
||||
* Get Error title.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -366,9 +376,10 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Error title
|
||||
* Set Error title.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return DataValidation
|
||||
*/
|
||||
public function setErrorTitle($value = '')
|
||||
|
@ -379,7 +390,7 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Error
|
||||
* Get Error.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -389,9 +400,10 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Error
|
||||
* Set Error.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return DataValidation
|
||||
*/
|
||||
public function setError($value = '')
|
||||
|
@ -402,7 +414,7 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Prompt title
|
||||
* Get Prompt title.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -412,9 +424,10 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Prompt title
|
||||
* Set Prompt title.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return DataValidation
|
||||
*/
|
||||
public function setPromptTitle($value = '')
|
||||
|
@ -425,7 +438,7 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Prompt
|
||||
* Get Prompt.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -435,9 +448,10 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Prompt
|
||||
* Set Prompt.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return DataValidation
|
||||
*/
|
||||
public function setPrompt($value = '')
|
||||
|
@ -448,7 +462,7 @@ class DataValidation
|
|||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
* Get hash code.
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Cell;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,16 +20,18 @@ namespace PhpOffice\PhpSpreadsheet\Cell;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class DefaultValueBinder implements IValueBinder
|
||||
{
|
||||
/**
|
||||
* Bind value to a cell
|
||||
* Bind value to a cell.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to bind value to
|
||||
* @param mixed $value Value to bind in cell
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function bindValue(\PhpOffice\PhpSpreadsheet\Cell $cell, $value = null)
|
||||
|
@ -54,9 +56,10 @@ class DefaultValueBinder implements IValueBinder
|
|||
}
|
||||
|
||||
/**
|
||||
* DataType for value
|
||||
* DataType for value.
|
||||
*
|
||||
* @param mixed $pValue
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function dataTypeForValue($pValue = null)
|
||||
|
@ -68,7 +71,7 @@ class DefaultValueBinder implements IValueBinder
|
|||
return DataType::TYPE_STRING;
|
||||
} elseif ($pValue instanceof \PhpOffice\PhpSpreadsheet\RichText) {
|
||||
return DataType::TYPE_INLINE;
|
||||
} elseif ($pValue{0} === '=' && strlen($pValue) > 1) {
|
||||
} elseif ($pValue[0] === '=' && strlen($pValue) > 1) {
|
||||
return DataType::TYPE_FORMULA;
|
||||
} elseif (is_bool($pValue)) {
|
||||
return DataType::TYPE_BOOL;
|
||||
|
@ -76,7 +79,7 @@ class DefaultValueBinder implements IValueBinder
|
|||
return DataType::TYPE_NUMERIC;
|
||||
} elseif (preg_match('/^[\+\-]?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)([Ee][\-\+]?[0-2]?\d{1,3})?$/', $pValue)) {
|
||||
$tValue = ltrim($pValue, '+-');
|
||||
if (is_string($pValue) && $tValue{0} === '0' && strlen($tValue) > 1 && $tValue{1} !== '.') {
|
||||
if (is_string($pValue) && $tValue[0] === '0' && strlen($tValue) > 1 && $tValue[1] !== '.') {
|
||||
return DataType::TYPE_STRING;
|
||||
} elseif ((strpos($pValue, '.') === false) && ($pValue > PHP_INT_MAX)) {
|
||||
return DataType::TYPE_STRING;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Cell;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,27 +20,28 @@ namespace PhpOffice\PhpSpreadsheet\Cell;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Hyperlink
|
||||
{
|
||||
/**
|
||||
* URL to link the cell to
|
||||
* URL to link the cell to.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $url;
|
||||
|
||||
/**
|
||||
* Tooltip to display on the hyperlink
|
||||
* Tooltip to display on the hyperlink.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $tooltip;
|
||||
|
||||
/**
|
||||
* Create a new Hyperlink
|
||||
* Create a new Hyperlink.
|
||||
*
|
||||
* @param string $pUrl Url to link the cell to
|
||||
* @param string $pTooltip Tooltip to display on the hyperlink
|
||||
|
@ -53,7 +54,7 @@ class Hyperlink
|
|||
}
|
||||
|
||||
/**
|
||||
* Get URL
|
||||
* Get URL.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -63,9 +64,10 @@ class Hyperlink
|
|||
}
|
||||
|
||||
/**
|
||||
* Set URL
|
||||
* Set URL.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return Hyperlink
|
||||
*/
|
||||
public function setUrl($value = '')
|
||||
|
@ -76,7 +78,7 @@ class Hyperlink
|
|||
}
|
||||
|
||||
/**
|
||||
* Get tooltip
|
||||
* Get tooltip.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -86,9 +88,10 @@ class Hyperlink
|
|||
}
|
||||
|
||||
/**
|
||||
* Set tooltip
|
||||
* Set tooltip.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return Hyperlink
|
||||
*/
|
||||
public function setTooltip($value = '')
|
||||
|
@ -99,7 +102,7 @@ class Hyperlink
|
|||
}
|
||||
|
||||
/**
|
||||
* Is this hyperlink internal? (to another worksheet)
|
||||
* Is this hyperlink internal? (to another worksheet).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -109,7 +112,7 @@ class Hyperlink
|
|||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
* Get hash code.
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Cell;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,16 +20,18 @@ namespace PhpOffice\PhpSpreadsheet\Cell;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
interface IValueBinder
|
||||
{
|
||||
/**
|
||||
* Bind value to a cell
|
||||
* Bind value to a cell.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to bind value to
|
||||
* @param mixed $value Value to bind in cell
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function bindValue(\PhpOffice\PhpSpreadsheet\Cell $cell, $value = null);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,146 +20,151 @@ namespace PhpOffice\PhpSpreadsheet;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Chart
|
||||
{
|
||||
/**
|
||||
* Chart Name
|
||||
* Chart Name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $name = '';
|
||||
|
||||
/**
|
||||
* Worksheet
|
||||
* Worksheet.
|
||||
*
|
||||
* @var Worksheet
|
||||
*/
|
||||
private $worksheet;
|
||||
|
||||
/**
|
||||
* Chart Title
|
||||
* Chart Title.
|
||||
*
|
||||
* @var Chart\Title
|
||||
*/
|
||||
private $title;
|
||||
|
||||
/**
|
||||
* Chart Legend
|
||||
* Chart Legend.
|
||||
*
|
||||
* @var Chart\Legend
|
||||
*/
|
||||
private $legend;
|
||||
|
||||
/**
|
||||
* X-Axis Label
|
||||
* X-Axis Label.
|
||||
*
|
||||
* @var Chart\Title
|
||||
*/
|
||||
private $xAxisLabel;
|
||||
|
||||
/**
|
||||
* Y-Axis Label
|
||||
* Y-Axis Label.
|
||||
*
|
||||
* @var Chart\Title
|
||||
*/
|
||||
private $yAxisLabel;
|
||||
|
||||
/**
|
||||
* Chart Plot Area
|
||||
* Chart Plot Area.
|
||||
*
|
||||
* @var Chart\PlotArea
|
||||
*/
|
||||
private $plotArea;
|
||||
|
||||
/**
|
||||
* Plot Visible Only
|
||||
* Plot Visible Only.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $plotVisibleOnly = true;
|
||||
|
||||
/**
|
||||
* Display Blanks as
|
||||
* Display Blanks as.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $displayBlanksAs = '0';
|
||||
|
||||
/**
|
||||
* Chart Asix Y as
|
||||
* Chart Asix Y as.
|
||||
*
|
||||
* @var Chart\Axis
|
||||
*/
|
||||
private $yAxis;
|
||||
|
||||
/**
|
||||
* Chart Asix X as
|
||||
* Chart Asix X as.
|
||||
*
|
||||
* @var Chart\Axis
|
||||
*/
|
||||
private $xAxis;
|
||||
|
||||
/**
|
||||
* Chart Major Gridlines as
|
||||
* Chart Major Gridlines as.
|
||||
*
|
||||
* @var Chart\GridLines
|
||||
*/
|
||||
private $majorGridlines;
|
||||
|
||||
/**
|
||||
* Chart Minor Gridlines as
|
||||
* Chart Minor Gridlines as.
|
||||
*
|
||||
* @var Chart\GridLines
|
||||
*/
|
||||
private $minorGridlines;
|
||||
|
||||
/**
|
||||
* Top-Left Cell Position
|
||||
* Top-Left Cell Position.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $topLeftCellRef = 'A1';
|
||||
|
||||
/**
|
||||
* Top-Left X-Offset
|
||||
* Top-Left X-Offset.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $topLeftXOffset = 0;
|
||||
|
||||
/**
|
||||
* Top-Left Y-Offset
|
||||
* Top-Left Y-Offset.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $topLeftYOffset = 0;
|
||||
|
||||
/**
|
||||
* Bottom-Right Cell Position
|
||||
* Bottom-Right Cell Position.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $bottomRightCellRef = 'A1';
|
||||
|
||||
/**
|
||||
* Bottom-Right X-Offset
|
||||
* Bottom-Right X-Offset.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $bottomRightXOffset = 10;
|
||||
|
||||
/**
|
||||
* Bottom-Right Y-Offset
|
||||
* Bottom-Right Y-Offset.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $bottomRightYOffset = 10;
|
||||
|
||||
/**
|
||||
* Create a new Chart
|
||||
* Create a new Chart.
|
||||
*
|
||||
* @param mixed $name
|
||||
* @param mixed $plotVisibleOnly
|
||||
* @param mixed $displayBlanksAs
|
||||
*/
|
||||
public function __construct($name, Chart\Title $title = null, Chart\Legend $legend = null, Chart\PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', Chart\Title $xAxisLabel = null, Chart\Title $yAxisLabel = null, Chart\Axis $xAxis = null, Chart\Axis $yAxis = null, Chart\GridLines $majorGridlines = null, Chart\GridLines $minorGridlines = null)
|
||||
{
|
||||
|
@ -178,7 +183,7 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Name
|
||||
* Get Name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -188,7 +193,7 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Worksheet
|
||||
* Get Worksheet.
|
||||
*
|
||||
* @return Worksheet
|
||||
*/
|
||||
|
@ -198,10 +203,12 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Worksheet
|
||||
* Set Worksheet.
|
||||
*
|
||||
* @param Worksheet $pValue
|
||||
*
|
||||
* @throws Chart\Exception
|
||||
*
|
||||
* @return Chart
|
||||
*/
|
||||
public function setWorksheet(Worksheet $pValue = null)
|
||||
|
@ -212,7 +219,7 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Title
|
||||
* Get Title.
|
||||
*
|
||||
* @return Chart\Title
|
||||
*/
|
||||
|
@ -222,9 +229,10 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Title
|
||||
* Set Title.
|
||||
*
|
||||
* @param Chart\Title $title
|
||||
*
|
||||
* @return Chart
|
||||
*/
|
||||
public function setTitle(Chart\Title $title)
|
||||
|
@ -235,7 +243,7 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Legend
|
||||
* Get Legend.
|
||||
*
|
||||
* @return Chart\Legend
|
||||
*/
|
||||
|
@ -245,9 +253,10 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Legend
|
||||
* Set Legend.
|
||||
*
|
||||
* @param Chart\Legend $legend
|
||||
*
|
||||
* @return Chart
|
||||
*/
|
||||
public function setLegend(Chart\Legend $legend)
|
||||
|
@ -258,7 +267,7 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Get X-Axis Label
|
||||
* Get X-Axis Label.
|
||||
*
|
||||
* @return Chart\Title
|
||||
*/
|
||||
|
@ -268,9 +277,10 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Set X-Axis Label
|
||||
* Set X-Axis Label.
|
||||
*
|
||||
* @param Chart\Title $label
|
||||
*
|
||||
* @return Chart
|
||||
*/
|
||||
public function setXAxisLabel(Chart\Title $label)
|
||||
|
@ -281,7 +291,7 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Y-Axis Label
|
||||
* Get Y-Axis Label.
|
||||
*
|
||||
* @return Chart\Title
|
||||
*/
|
||||
|
@ -291,9 +301,10 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Y-Axis Label
|
||||
* Set Y-Axis Label.
|
||||
*
|
||||
* @param Chart\Title $label
|
||||
*
|
||||
* @return Chart
|
||||
*/
|
||||
public function setYAxisLabel(Chart\Title $label)
|
||||
|
@ -304,7 +315,7 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Plot Area
|
||||
* Get Plot Area.
|
||||
*
|
||||
* @return Chart\PlotArea
|
||||
*/
|
||||
|
@ -314,7 +325,7 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Plot Visible Only
|
||||
* Get Plot Visible Only.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -324,9 +335,10 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Plot Visible Only
|
||||
* Set Plot Visible Only.
|
||||
*
|
||||
* @param bool $plotVisibleOnly
|
||||
*
|
||||
* @return Chart
|
||||
*/
|
||||
public function setPlotVisibleOnly($plotVisibleOnly = true)
|
||||
|
@ -337,7 +349,7 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Display Blanks as
|
||||
* Get Display Blanks as.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -347,9 +359,10 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Display Blanks as
|
||||
* Set Display Blanks as.
|
||||
*
|
||||
* @param string $displayBlanksAs
|
||||
*
|
||||
* @return Chart
|
||||
*/
|
||||
public function setDisplayBlanksAs($displayBlanksAs = '0')
|
||||
|
@ -358,7 +371,7 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Get yAxis
|
||||
* Get yAxis.
|
||||
*
|
||||
* @return Chart\Axis
|
||||
*/
|
||||
|
@ -372,7 +385,7 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Get xAxis
|
||||
* Get xAxis.
|
||||
*
|
||||
* @return Chart\Axis
|
||||
*/
|
||||
|
@ -386,7 +399,7 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Major Gridlines
|
||||
* Get Major Gridlines.
|
||||
*
|
||||
* @return Chart\GridLines
|
||||
*/
|
||||
|
@ -400,7 +413,7 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Minor Gridlines
|
||||
* Get Minor Gridlines.
|
||||
*
|
||||
* @return Chart\GridLines
|
||||
*/
|
||||
|
@ -414,11 +427,12 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the Top Left position for the chart
|
||||
* Set the Top Left position for the chart.
|
||||
*
|
||||
* @param string $cell
|
||||
* @param int $xOffset
|
||||
* @param int $yOffset
|
||||
*
|
||||
* @return Chart
|
||||
*/
|
||||
public function setTopLeftPosition($cell, $xOffset = null, $yOffset = null)
|
||||
|
@ -435,7 +449,7 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the top left position of the chart
|
||||
* Get the top left position of the chart.
|
||||
*
|
||||
* @return array an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell
|
||||
*/
|
||||
|
@ -449,7 +463,7 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the cell address where the top left of the chart is fixed
|
||||
* Get the cell address where the top left of the chart is fixed.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -459,9 +473,10 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the Top Left cell position for the chart
|
||||
* Set the Top Left cell position for the chart.
|
||||
*
|
||||
* @param string $cell
|
||||
*
|
||||
* @return Chart
|
||||
*/
|
||||
public function setTopLeftCell($cell)
|
||||
|
@ -472,10 +487,11 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the offset position within the Top Left cell for the chart
|
||||
* Set the offset position within the Top Left cell for the chart.
|
||||
*
|
||||
* @param int $xOffset
|
||||
* @param int $yOffset
|
||||
*
|
||||
* @return Chart
|
||||
*/
|
||||
public function setTopLeftOffset($xOffset = null, $yOffset = null)
|
||||
|
@ -491,7 +507,7 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the offset position within the Top Left cell for the chart
|
||||
* Get the offset position within the Top Left cell for the chart.
|
||||
*
|
||||
* @return int[]
|
||||
*/
|
||||
|
@ -528,11 +544,12 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the Bottom Right position of the chart
|
||||
* Set the Bottom Right position of the chart.
|
||||
*
|
||||
* @param string $cell
|
||||
* @param int $xOffset
|
||||
* @param int $yOffset
|
||||
*
|
||||
* @return Chart
|
||||
*/
|
||||
public function setBottomRightPosition($cell, $xOffset = null, $yOffset = null)
|
||||
|
@ -549,7 +566,7 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the bottom right position of the chart
|
||||
* Get the bottom right position of the chart.
|
||||
*
|
||||
* @return array an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell
|
||||
*/
|
||||
|
@ -570,7 +587,7 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the cell address where the bottom right of the chart is fixed
|
||||
* Get the cell address where the bottom right of the chart is fixed.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -580,10 +597,11 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the offset position within the Bottom Right cell for the chart
|
||||
* Set the offset position within the Bottom Right cell for the chart.
|
||||
*
|
||||
* @param int $xOffset
|
||||
* @param int $yOffset
|
||||
*
|
||||
* @return Chart
|
||||
*/
|
||||
public function setBottomRightOffset($xOffset = null, $yOffset = null)
|
||||
|
@ -599,7 +617,7 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the offset position within the Bottom Right cell for the chart
|
||||
* Get the offset position within the Bottom Right cell for the chart.
|
||||
*
|
||||
* @return int[]
|
||||
*/
|
||||
|
|
|
@ -6,12 +6,12 @@ namespace PhpOffice\PhpSpreadsheet\Chart;
|
|||
* Created by PhpStorm.
|
||||
* User: Wiktor Trzonkowski
|
||||
* Date: 6/17/14
|
||||
* Time: 12:11 PM
|
||||
* Time: 12:11 PM.
|
||||
*/
|
||||
class Axis extends Properties
|
||||
{
|
||||
/**
|
||||
* Axis Number
|
||||
* Axis Number.
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
|
@ -21,7 +21,7 @@ class Axis extends Properties
|
|||
];
|
||||
|
||||
/**
|
||||
* Axis Options
|
||||
* Axis Options.
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
|
@ -39,7 +39,7 @@ class Axis extends Properties
|
|||
];
|
||||
|
||||
/**
|
||||
* Fill Properties
|
||||
* Fill Properties.
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
|
@ -50,7 +50,7 @@ class Axis extends Properties
|
|||
];
|
||||
|
||||
/**
|
||||
* Line Properties
|
||||
* Line Properties.
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
|
@ -61,7 +61,7 @@ class Axis extends Properties
|
|||
];
|
||||
|
||||
/**
|
||||
* Line Style Properties
|
||||
* Line Style Properties.
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
|
@ -84,7 +84,7 @@ class Axis extends Properties
|
|||
];
|
||||
|
||||
/**
|
||||
* Shadow Properties
|
||||
* Shadow Properties.
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
|
@ -109,7 +109,7 @@ class Axis extends Properties
|
|||
];
|
||||
|
||||
/**
|
||||
* Glow Properties
|
||||
* Glow Properties.
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
|
@ -123,7 +123,7 @@ class Axis extends Properties
|
|||
];
|
||||
|
||||
/**
|
||||
* Soft Edge Properties
|
||||
* Soft Edge Properties.
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
|
@ -132,7 +132,9 @@ class Axis extends Properties
|
|||
];
|
||||
|
||||
/**
|
||||
* Get Series Data Type
|
||||
* Get Series Data Type.
|
||||
*
|
||||
* @param mixed $format_code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -143,7 +145,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Axis Number Format Data Type
|
||||
* Get Axis Number Format Data Type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -153,7 +155,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Axis Number Source Linked
|
||||
* Get Axis Number Source Linked.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -163,7 +165,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Axis Options Properties
|
||||
* Set Axis Options Properties.
|
||||
*
|
||||
* @param string $axis_labels
|
||||
* @param string $horizontal_crosses_value
|
||||
|
@ -192,7 +194,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Axis Options Property
|
||||
* Get Axis Options Property.
|
||||
*
|
||||
* @param string $property
|
||||
*
|
||||
|
@ -204,7 +206,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Axis Orientation Property
|
||||
* Set Axis Orientation Property.
|
||||
*
|
||||
* @param string $orientation
|
||||
*/
|
||||
|
@ -214,7 +216,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Fill Property
|
||||
* Set Fill Property.
|
||||
*
|
||||
* @param string $color
|
||||
* @param int $alpha
|
||||
|
@ -226,7 +228,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Line Property
|
||||
* Set Line Property.
|
||||
*
|
||||
* @param string $color
|
||||
* @param int $alpha
|
||||
|
@ -238,7 +240,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Fill Property
|
||||
* Get Fill Property.
|
||||
*
|
||||
* @param string $property
|
||||
*
|
||||
|
@ -250,7 +252,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Line Property
|
||||
* Get Line Property.
|
||||
*
|
||||
* @param string $property
|
||||
*
|
||||
|
@ -262,7 +264,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Line Style Properties
|
||||
* Set Line Style Properties.
|
||||
*
|
||||
* @param float $line_width
|
||||
* @param string $compound_type
|
||||
|
@ -288,7 +290,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Line Style Property
|
||||
* Get Line Style Property.
|
||||
*
|
||||
* @param array|string $elements
|
||||
*
|
||||
|
@ -300,7 +302,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Line Style Arrow Excel Width
|
||||
* Get Line Style Arrow Excel Width.
|
||||
*
|
||||
* @param string $arrow
|
||||
*
|
||||
|
@ -312,7 +314,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Line Style Arrow Excel Length
|
||||
* Get Line Style Arrow Excel Length.
|
||||
*
|
||||
* @param string $arrow
|
||||
*
|
||||
|
@ -324,7 +326,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Properties
|
||||
* Set Shadow Properties.
|
||||
*
|
||||
* @param int $sh_presets
|
||||
* @param string $sh_color_value
|
||||
|
@ -348,7 +350,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Color
|
||||
* Set Shadow Color.
|
||||
*
|
||||
* @param int $shadow_presets
|
||||
*
|
||||
|
@ -363,7 +365,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Properties from Maped Values
|
||||
* Set Shadow Properties from Maped Values.
|
||||
*
|
||||
* @param array $properties_map
|
||||
* @param * $reference
|
||||
|
@ -394,7 +396,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Color
|
||||
* Set Shadow Color.
|
||||
*
|
||||
* @param string $color
|
||||
* @param int $alpha
|
||||
|
@ -410,7 +412,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Blur
|
||||
* Set Shadow Blur.
|
||||
*
|
||||
* @param float $blur
|
||||
*
|
||||
|
@ -426,7 +428,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Angle
|
||||
* Set Shadow Angle.
|
||||
*
|
||||
* @param int $angle
|
||||
*
|
||||
|
@ -442,7 +444,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Distance
|
||||
* Set Shadow Distance.
|
||||
*
|
||||
* @param float $distance
|
||||
*
|
||||
|
@ -458,7 +460,9 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Shadow Property
|
||||
* Get Shadow Property.
|
||||
*
|
||||
* @param mixed $elements
|
||||
*/
|
||||
public function getShadowProperty($elements)
|
||||
{
|
||||
|
@ -466,7 +470,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Glow Properties
|
||||
* Set Glow Properties.
|
||||
*
|
||||
* @param float $size
|
||||
* @param string $color_value
|
||||
|
@ -484,7 +488,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Glow Property
|
||||
* Get Glow Property.
|
||||
*
|
||||
* @param array|string $property
|
||||
*
|
||||
|
@ -496,7 +500,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Glow Color
|
||||
* Set Glow Color.
|
||||
*
|
||||
* @param float $size
|
||||
*
|
||||
|
@ -512,7 +516,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Glow Color
|
||||
* Set Glow Color.
|
||||
*
|
||||
* @param string $color
|
||||
* @param int $alpha
|
||||
|
@ -528,7 +532,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Soft Edges Size
|
||||
* Set Soft Edges Size.
|
||||
*
|
||||
* @param float $size
|
||||
*/
|
||||
|
@ -540,7 +544,7 @@ class Axis extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Soft Edges Size
|
||||
* Get Soft Edges Size.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Chart;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -60,70 +61,80 @@ class DataSeries
|
|||
const STYLE_FILLED = 'filled';
|
||||
|
||||
/**
|
||||
* Series Plot Type
|
||||
* Series Plot Type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $plotType;
|
||||
|
||||
/**
|
||||
* Plot Grouping Type
|
||||
* Plot Grouping Type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $plotGrouping;
|
||||
|
||||
/**
|
||||
* Plot Direction
|
||||
* Plot Direction.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $plotDirection;
|
||||
|
||||
/**
|
||||
* Plot Style
|
||||
* Plot Style.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $plotStyle;
|
||||
|
||||
/**
|
||||
* Order of plots in Series
|
||||
* Order of plots in Series.
|
||||
*
|
||||
* @var array of integer
|
||||
*/
|
||||
private $plotOrder = [];
|
||||
|
||||
/**
|
||||
* Plot Label
|
||||
* Plot Label.
|
||||
*
|
||||
* @var array of DataSeriesValues
|
||||
*/
|
||||
private $plotLabel = [];
|
||||
|
||||
/**
|
||||
* Plot Category
|
||||
* Plot Category.
|
||||
*
|
||||
* @var array of DataSeriesValues
|
||||
*/
|
||||
private $plotCategory = [];
|
||||
|
||||
/**
|
||||
* Smooth Line
|
||||
* Smooth Line.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $smoothLine;
|
||||
|
||||
/**
|
||||
* Plot Values
|
||||
* Plot Values.
|
||||
*
|
||||
* @var array of DataSeriesValues
|
||||
*/
|
||||
private $plotValues = [];
|
||||
|
||||
/**
|
||||
* Create a new DataSeries
|
||||
* Create a new DataSeries.
|
||||
*
|
||||
* @param null|mixed $plotType
|
||||
* @param null|mixed $plotGrouping
|
||||
* @param mixed $plotOrder
|
||||
* @param mixed $plotLabel
|
||||
* @param mixed $plotCategory
|
||||
* @param mixed $plotValues
|
||||
* @param null|mixed $plotDirection
|
||||
* @param null|mixed $smoothLine
|
||||
* @param null|mixed $plotStyle
|
||||
*/
|
||||
public function __construct($plotType = null, $plotGrouping = null, $plotOrder = [], $plotLabel = [], $plotCategory = [], $plotValues = [], $plotDirection = null, $smoothLine = null, $plotStyle = null)
|
||||
{
|
||||
|
@ -151,7 +162,7 @@ class DataSeries
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Plot Type
|
||||
* Get Plot Type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -161,9 +172,10 @@ class DataSeries
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Plot Type
|
||||
* Set Plot Type.
|
||||
*
|
||||
* @param string $plotType
|
||||
*
|
||||
* @return DataSeries
|
||||
*/
|
||||
public function setPlotType($plotType = '')
|
||||
|
@ -174,7 +186,7 @@ class DataSeries
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Plot Grouping Type
|
||||
* Get Plot Grouping Type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -184,9 +196,10 @@ class DataSeries
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Plot Grouping Type
|
||||
* Set Plot Grouping Type.
|
||||
*
|
||||
* @param string $groupingType
|
||||
*
|
||||
* @return DataSeries
|
||||
*/
|
||||
public function setPlotGrouping($groupingType = null)
|
||||
|
@ -197,7 +210,7 @@ class DataSeries
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Plot Direction
|
||||
* Get Plot Direction.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -207,9 +220,10 @@ class DataSeries
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Plot Direction
|
||||
* Set Plot Direction.
|
||||
*
|
||||
* @param string $plotDirection
|
||||
*
|
||||
* @return DataSeries
|
||||
*/
|
||||
public function setPlotDirection($plotDirection = null)
|
||||
|
@ -220,7 +234,7 @@ class DataSeries
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Plot Order
|
||||
* Get Plot Order.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -230,7 +244,7 @@ class DataSeries
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Plot Labels
|
||||
* Get Plot Labels.
|
||||
*
|
||||
* @return array of DataSeriesValues
|
||||
*/
|
||||
|
@ -240,7 +254,9 @@ class DataSeries
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Plot Label by Index
|
||||
* Get Plot Label by Index.
|
||||
*
|
||||
* @param mixed $index
|
||||
*
|
||||
* @return DataSeriesValues
|
||||
*/
|
||||
|
@ -257,7 +273,7 @@ class DataSeries
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Plot Categories
|
||||
* Get Plot Categories.
|
||||
*
|
||||
* @return array of DataSeriesValues
|
||||
*/
|
||||
|
@ -267,7 +283,9 @@ class DataSeries
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Plot Category by Index
|
||||
* Get Plot Category by Index.
|
||||
*
|
||||
* @param mixed $index
|
||||
*
|
||||
* @return DataSeriesValues
|
||||
*/
|
||||
|
@ -284,7 +302,7 @@ class DataSeries
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Plot Style
|
||||
* Get Plot Style.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -294,9 +312,10 @@ class DataSeries
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Plot Style
|
||||
* Set Plot Style.
|
||||
*
|
||||
* @param string $plotStyle
|
||||
*
|
||||
* @return DataSeries
|
||||
*/
|
||||
public function setPlotStyle($plotStyle = null)
|
||||
|
@ -307,7 +326,7 @@ class DataSeries
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Plot Values
|
||||
* Get Plot Values.
|
||||
*
|
||||
* @return array of DataSeriesValues
|
||||
*/
|
||||
|
@ -317,7 +336,9 @@ class DataSeries
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Plot Values by Index
|
||||
* Get Plot Values by Index.
|
||||
*
|
||||
* @param mixed $index
|
||||
*
|
||||
* @return DataSeriesValues
|
||||
*/
|
||||
|
@ -334,7 +355,7 @@ class DataSeries
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Number of Plot Series
|
||||
* Get Number of Plot Series.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
@ -344,7 +365,7 @@ class DataSeries
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Smooth Line
|
||||
* Get Smooth Line.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -354,9 +375,10 @@ class DataSeries
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Smooth Line
|
||||
* Set Smooth Line.
|
||||
*
|
||||
* @param bool $smoothLine
|
||||
*
|
||||
* @return DataSeries
|
||||
*/
|
||||
public function setSmoothLine($smoothLine = true)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Chart;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -34,50 +35,56 @@ class DataSeriesValues
|
|||
];
|
||||
|
||||
/**
|
||||
* Series Data Type
|
||||
* Series Data Type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $dataType;
|
||||
|
||||
/**
|
||||
* Series Data Source
|
||||
* Series Data Source.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $dataSource;
|
||||
|
||||
/**
|
||||
* Format Code
|
||||
* Format Code.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $formatCode;
|
||||
|
||||
/**
|
||||
* Series Point Marker
|
||||
* Series Point Marker.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $pointMarker;
|
||||
|
||||
/**
|
||||
* Point Count (The number of datapoints in the dataseries)
|
||||
* Point Count (The number of datapoints in the dataseries).
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $pointCount = 0;
|
||||
|
||||
/**
|
||||
* Data Values
|
||||
* Data Values.
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
private $dataValues = [];
|
||||
|
||||
/**
|
||||
* Create a new DataSeriesValues object
|
||||
* Create a new DataSeriesValues object.
|
||||
*
|
||||
* @param string $dataSource
|
||||
* @param mixed $dataType
|
||||
* @param null|mixed $formatCode
|
||||
* @param mixed $pointCount
|
||||
* @param mixed $dataValues
|
||||
* @param null|mixed $marker
|
||||
*/
|
||||
public function __construct($dataType = self::DATASERIES_TYPE_NUMBER, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = [], $marker = null)
|
||||
{
|
||||
|
@ -90,7 +97,7 @@ class DataSeriesValues
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Series Data Type
|
||||
* Get Series Data Type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -100,7 +107,7 @@ class DataSeriesValues
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Series Data Type
|
||||
* Set Series Data Type.
|
||||
*
|
||||
* @param string $dataType Datatype of this data series
|
||||
* Typical values are:
|
||||
|
@ -108,7 +115,9 @@ class DataSeriesValues
|
|||
* Normally used for axis point values
|
||||
* \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues::DATASERIES_TYPE_NUMBER
|
||||
* Normally used for chart data values
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return DataSeriesValues
|
||||
*/
|
||||
public function setDataType($dataType = self::DATASERIES_TYPE_NUMBER)
|
||||
|
@ -122,7 +131,7 @@ class DataSeriesValues
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Series Data Source (formula)
|
||||
* Get Series Data Source (formula).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -132,9 +141,11 @@ class DataSeriesValues
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Series Data Source (formula)
|
||||
* Set Series Data Source (formula).
|
||||
*
|
||||
* @param string $dataSource
|
||||
* @param mixed $refreshDataValues
|
||||
*
|
||||
* @return DataSeriesValues
|
||||
*/
|
||||
public function setDataSource($dataSource = null, $refreshDataValues = true)
|
||||
|
@ -149,7 +160,7 @@ class DataSeriesValues
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Point Marker
|
||||
* Get Point Marker.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -159,9 +170,10 @@ class DataSeriesValues
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Point Marker
|
||||
* Set Point Marker.
|
||||
*
|
||||
* @param string $marker
|
||||
*
|
||||
* @return DataSeriesValues
|
||||
*/
|
||||
public function setPointMarker($marker = null)
|
||||
|
@ -172,7 +184,7 @@ class DataSeriesValues
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Series Format Code
|
||||
* Get Series Format Code.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -182,9 +194,10 @@ class DataSeriesValues
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Series Format Code
|
||||
* Set Series Format Code.
|
||||
*
|
||||
* @param string $formatCode
|
||||
*
|
||||
* @return DataSeriesValues
|
||||
*/
|
||||
public function setFormatCode($formatCode = null)
|
||||
|
@ -195,7 +208,7 @@ class DataSeriesValues
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Series Point Count
|
||||
* Get Series Point Count.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
@ -205,7 +218,7 @@ class DataSeriesValues
|
|||
}
|
||||
|
||||
/**
|
||||
* Identify if the Data Series is a multi-level or a simple series
|
||||
* Identify if the Data Series is a multi-level or a simple series.
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
|
@ -219,7 +232,7 @@ class DataSeriesValues
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the level count of a multi-level Data Series
|
||||
* Return the level count of a multi-level Data Series.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
@ -234,7 +247,7 @@ class DataSeriesValues
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Series Data Values
|
||||
* Get Series Data Values.
|
||||
*
|
||||
* @return array of mixed
|
||||
*/
|
||||
|
@ -244,7 +257,7 @@ class DataSeriesValues
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the first Series Data value
|
||||
* Get the first Series Data value.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
@ -261,12 +274,13 @@ class DataSeriesValues
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Series Data Values
|
||||
* Set Series Data Values.
|
||||
*
|
||||
* @param array $dataValues
|
||||
* @param bool $refreshDataSource
|
||||
* TRUE - refresh the value of dataSource based on the values of $dataValues
|
||||
* FALSE - don't change the value of dataSource
|
||||
*
|
||||
* @return DataSeriesValues
|
||||
*/
|
||||
public function setDataValues($dataValues = [], $refreshDataSource = true)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Chart;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet\Chart;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Exception extends \PhpOffice\PhpSpreadsheet\Exception
|
||||
{
|
||||
/**
|
||||
* Error handler callback
|
||||
* Error handler callback.
|
||||
*
|
||||
* @param mixed $code
|
||||
* @param mixed $string
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart;
|
|||
* Created by PhpStorm.
|
||||
* User: Wiktor Trzonkowski
|
||||
* Date: 7/2/14
|
||||
* Time: 2:36 PM
|
||||
* Time: 2:36 PM.
|
||||
*/
|
||||
class GridLines extends Properties
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ class GridLines extends Properties
|
|||
* Line Properties @var array of mixed
|
||||
* Shadow Properties @var array of mixed
|
||||
* Glow Properties @var array of mixed
|
||||
* Soft Properties @var array of mixed
|
||||
* Soft Properties @var array of mixed.
|
||||
*/
|
||||
private $objectState = false;
|
||||
|
||||
|
@ -79,7 +79,7 @@ class GridLines extends Properties
|
|||
];
|
||||
|
||||
/**
|
||||
* Get Object State
|
||||
* Get Object State.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -89,7 +89,7 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Change Object State to True
|
||||
* Change Object State to True.
|
||||
*
|
||||
* @return GridLines
|
||||
*/
|
||||
|
@ -101,7 +101,7 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Line Color Properties
|
||||
* Set Line Color Properties.
|
||||
*
|
||||
* @param string $value
|
||||
* @param int $alpha
|
||||
|
@ -118,7 +118,7 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Line Color Properties
|
||||
* Set Line Color Properties.
|
||||
*
|
||||
* @param float $line_width
|
||||
* @param string $compound_type
|
||||
|
@ -163,7 +163,7 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Line Color Property
|
||||
* Get Line Color Property.
|
||||
*
|
||||
* @param string $parameter
|
||||
*
|
||||
|
@ -175,7 +175,7 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Line Style Property
|
||||
* Get Line Style Property.
|
||||
*
|
||||
* @param array|string $elements
|
||||
*
|
||||
|
@ -187,7 +187,7 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Glow Properties
|
||||
* Set Glow Properties.
|
||||
*
|
||||
* @param float $size
|
||||
* @param string $color_value
|
||||
|
@ -203,7 +203,7 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Glow Color Property
|
||||
* Get Glow Color Property.
|
||||
*
|
||||
* @param string $property
|
||||
*
|
||||
|
@ -215,7 +215,7 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Glow Size
|
||||
* Get Glow Size.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -225,7 +225,7 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Glow Size
|
||||
* Set Glow Size.
|
||||
*
|
||||
* @param float $size
|
||||
*
|
||||
|
@ -239,7 +239,7 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Glow Color
|
||||
* Set Glow Color.
|
||||
*
|
||||
* @param string $color
|
||||
* @param int $alpha
|
||||
|
@ -263,7 +263,7 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Line Style Arrow Parameters
|
||||
* Get Line Style Arrow Parameters.
|
||||
*
|
||||
* @param string $arrow_selector
|
||||
* @param string $property_selector
|
||||
|
@ -276,7 +276,7 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Properties
|
||||
* Set Shadow Properties.
|
||||
*
|
||||
* @param int $sh_presets
|
||||
* @param string $sh_color_value
|
||||
|
@ -301,7 +301,7 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Presets Properties
|
||||
* Set Shadow Presets Properties.
|
||||
*
|
||||
* @param int $shadow_presets
|
||||
*
|
||||
|
@ -316,7 +316,7 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Properties Values
|
||||
* Set Shadow Properties Values.
|
||||
*
|
||||
* @param array $properties_map
|
||||
* @param * $reference
|
||||
|
@ -347,11 +347,12 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Color
|
||||
* Set Shadow Color.
|
||||
*
|
||||
* @param string $color
|
||||
* @param int $alpha
|
||||
* @param string $type
|
||||
*
|
||||
* @return GridLines
|
||||
*/
|
||||
private function setShadowColor($color, $alpha, $type)
|
||||
|
@ -370,7 +371,7 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Blur
|
||||
* Set Shadow Blur.
|
||||
*
|
||||
* @param float $blur
|
||||
*
|
||||
|
@ -386,9 +387,10 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Angle
|
||||
* Set Shadow Angle.
|
||||
*
|
||||
* @param int $angle
|
||||
*
|
||||
* @return GridLines
|
||||
*/
|
||||
private function setShadowAngle($angle)
|
||||
|
@ -401,9 +403,10 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Distance
|
||||
* Set Shadow Distance.
|
||||
*
|
||||
* @param float $distance
|
||||
*
|
||||
* @return GridLines
|
||||
*/
|
||||
private function setShadowDistance($distance)
|
||||
|
@ -416,10 +419,11 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Shadow Property
|
||||
* Get Shadow Property.
|
||||
*
|
||||
* @param string $elements
|
||||
* @param array $elements
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getShadowProperty($elements)
|
||||
|
@ -428,7 +432,7 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Soft Edges Size
|
||||
* Set Soft Edges Size.
|
||||
*
|
||||
* @param float $size
|
||||
*/
|
||||
|
@ -441,7 +445,7 @@ class GridLines extends Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Soft Edges Size
|
||||
* Get Soft Edges Size.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Chart;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,55 +20,56 @@ namespace PhpOffice\PhpSpreadsheet\Chart;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Layout
|
||||
{
|
||||
/**
|
||||
* layoutTarget
|
||||
* layoutTarget.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $layoutTarget;
|
||||
|
||||
/**
|
||||
* X Mode
|
||||
* X Mode.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $xMode;
|
||||
|
||||
/**
|
||||
* Y Mode
|
||||
* Y Mode.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $yMode;
|
||||
|
||||
/**
|
||||
* X-Position
|
||||
* X-Position.
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
private $xPos;
|
||||
|
||||
/**
|
||||
* Y-Position
|
||||
* Y-Position.
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
private $yPos;
|
||||
|
||||
/**
|
||||
* width
|
||||
* width.
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
private $width;
|
||||
|
||||
/**
|
||||
* height
|
||||
* height.
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
|
@ -76,7 +77,7 @@ class Layout
|
|||
|
||||
/**
|
||||
* show legend key
|
||||
* Specifies that legend keys should be shown in data labels
|
||||
* Specifies that legend keys should be shown in data labels.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
|
@ -115,7 +116,7 @@ class Layout
|
|||
private $showPercent;
|
||||
|
||||
/**
|
||||
* show bubble size
|
||||
* show bubble size.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
|
@ -130,7 +131,9 @@ class Layout
|
|||
private $showLeaderLines;
|
||||
|
||||
/**
|
||||
* Create a new Layout
|
||||
* Create a new Layout.
|
||||
*
|
||||
* @param mixed $layout
|
||||
*/
|
||||
public function __construct($layout = [])
|
||||
{
|
||||
|
@ -158,7 +161,7 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Layout Target
|
||||
* Get Layout Target.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -168,10 +171,11 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Layout Target
|
||||
* Set Layout Target.
|
||||
*
|
||||
* @param Layout Target $value
|
||||
* @param string $value
|
||||
*
|
||||
* @return Layout
|
||||
*/
|
||||
public function setLayoutTarget($value)
|
||||
|
@ -182,7 +186,7 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Get X-Mode
|
||||
* Get X-Mode.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -192,9 +196,10 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Set X-Mode
|
||||
* Set X-Mode.
|
||||
*
|
||||
* @param X-Mode $value
|
||||
*
|
||||
* @return Layout
|
||||
*/
|
||||
public function setXMode($value)
|
||||
|
@ -205,7 +210,7 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Y-Mode
|
||||
* Get Y-Mode.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -215,9 +220,10 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Y-Mode
|
||||
* Set Y-Mode.
|
||||
*
|
||||
* @param Y-Mode $value
|
||||
*
|
||||
* @return Layout
|
||||
*/
|
||||
public function setYMode($value)
|
||||
|
@ -228,7 +234,7 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Get X-Position
|
||||
* Get X-Position.
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
|
@ -238,9 +244,10 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Set X-Position
|
||||
* Set X-Position.
|
||||
*
|
||||
* @param X-Position $value
|
||||
*
|
||||
* @return Layout
|
||||
*/
|
||||
public function setXPosition($value)
|
||||
|
@ -251,7 +258,7 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Y-Position
|
||||
* Get Y-Position.
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
|
@ -261,9 +268,10 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Y-Position
|
||||
* Set Y-Position.
|
||||
*
|
||||
* @param Y-Position $value
|
||||
*
|
||||
* @return Layout
|
||||
*/
|
||||
public function setYPosition($value)
|
||||
|
@ -274,7 +282,7 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Width
|
||||
* Get Width.
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
|
@ -284,9 +292,10 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Width
|
||||
* Set Width.
|
||||
*
|
||||
* @param Width $value
|
||||
*
|
||||
* @return Layout
|
||||
*/
|
||||
public function setWidth($value)
|
||||
|
@ -297,7 +306,7 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Height
|
||||
* Get Height.
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
|
@ -307,9 +316,10 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Height
|
||||
* Set Height.
|
||||
*
|
||||
* @param Height $value
|
||||
*
|
||||
* @return Layout
|
||||
*/
|
||||
public function setHeight($value)
|
||||
|
@ -320,7 +330,7 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Get show legend key
|
||||
* Get show legend key.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -334,6 +344,7 @@ class Layout
|
|||
* Specifies that legend keys should be shown in data labels.
|
||||
*
|
||||
* @param bool $value Show legend key
|
||||
*
|
||||
* @return Layout
|
||||
*/
|
||||
public function setShowLegendKey($value)
|
||||
|
@ -344,7 +355,7 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Get show value
|
||||
* Get show value.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -358,6 +369,7 @@ class Layout
|
|||
* Specifies that the value should be shown in data labels.
|
||||
*
|
||||
* @param bool $value Show val
|
||||
*
|
||||
* @return Layout
|
||||
*/
|
||||
public function setShowVal($value)
|
||||
|
@ -368,7 +380,7 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Get show category name
|
||||
* Get show category name.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -382,6 +394,7 @@ class Layout
|
|||
* Specifies that the category name should be shown in data labels.
|
||||
*
|
||||
* @param bool $value Show cat name
|
||||
*
|
||||
* @return Layout
|
||||
*/
|
||||
public function setShowCatName($value)
|
||||
|
@ -392,7 +405,7 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Get show data series name
|
||||
* Get show data series name.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -406,6 +419,7 @@ class Layout
|
|||
* Specifies that the series name should be shown in data labels.
|
||||
*
|
||||
* @param bool $value Show series name
|
||||
*
|
||||
* @return Layout
|
||||
*/
|
||||
public function setShowSerName($value)
|
||||
|
@ -416,7 +430,7 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Get show percentage
|
||||
* Get show percentage.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -430,6 +444,7 @@ class Layout
|
|||
* Specifies that the percentage should be shown in data labels.
|
||||
*
|
||||
* @param bool $value Show percentage
|
||||
*
|
||||
* @return Layout
|
||||
*/
|
||||
public function setShowPercent($value)
|
||||
|
@ -440,7 +455,7 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Get show bubble size
|
||||
* Get show bubble size.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -454,6 +469,7 @@ class Layout
|
|||
* Specifies that the bubble size should be shown in data labels.
|
||||
*
|
||||
* @param bool $value Show bubble size
|
||||
*
|
||||
* @return Layout
|
||||
*/
|
||||
public function setShowBubbleSize($value)
|
||||
|
@ -464,7 +480,7 @@ class Layout
|
|||
}
|
||||
|
||||
/**
|
||||
* Get show leader lines
|
||||
* Get show leader lines.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -478,6 +494,7 @@ class Layout
|
|||
* Specifies that leader lines should be shown in data labels.
|
||||
*
|
||||
* @param bool $value Show leader lines
|
||||
*
|
||||
* @return Layout
|
||||
*/
|
||||
public function setShowLeaderLines($value)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Chart;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -49,7 +50,7 @@ class Legend
|
|||
];
|
||||
|
||||
/**
|
||||
* Legend position
|
||||
* Legend position.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
@ -63,14 +64,17 @@ class Legend
|
|||
private $overlay = true;
|
||||
|
||||
/**
|
||||
* Legend Layout
|
||||
* Legend Layout.
|
||||
*
|
||||
* @var Layout
|
||||
*/
|
||||
private $layout = null;
|
||||
|
||||
/**
|
||||
* Create a new Legend
|
||||
* Create a new Legend.
|
||||
*
|
||||
* @param mixed $position
|
||||
* @param mixed $overlay
|
||||
*/
|
||||
public function __construct($position = self::POSITION_RIGHT, Layout $layout = null, $overlay = false)
|
||||
{
|
||||
|
@ -80,7 +84,7 @@ class Legend
|
|||
}
|
||||
|
||||
/**
|
||||
* Get legend position as an excel string value
|
||||
* Get legend position as an excel string value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -90,7 +94,7 @@ class Legend
|
|||
}
|
||||
|
||||
/**
|
||||
* Get legend position using an excel string value
|
||||
* Get legend position using an excel string value.
|
||||
*
|
||||
* @param string $position
|
||||
*/
|
||||
|
@ -106,7 +110,7 @@ class Legend
|
|||
}
|
||||
|
||||
/**
|
||||
* Get legend position as an Excel internal numeric value
|
||||
* Get legend position as an Excel internal numeric value.
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
|
@ -116,7 +120,7 @@ class Legend
|
|||
}
|
||||
|
||||
/**
|
||||
* Set legend position using an Excel internal numeric value
|
||||
* Set legend position using an Excel internal numeric value.
|
||||
*
|
||||
* @param number $positionXL
|
||||
*/
|
||||
|
@ -145,6 +149,7 @@ class Legend
|
|||
* Set allow overlay of other elements?
|
||||
*
|
||||
* @param bool $overlay
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setOverlay($overlay = false)
|
||||
|
@ -159,7 +164,7 @@ class Legend
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Layout
|
||||
* Get Layout.
|
||||
*
|
||||
* @return Layout
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Chart;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,27 +20,30 @@ namespace PhpOffice\PhpSpreadsheet\Chart;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class PlotArea
|
||||
{
|
||||
/**
|
||||
* PlotArea Layout
|
||||
* PlotArea Layout.
|
||||
*
|
||||
* @var Layout
|
||||
*/
|
||||
private $layout = null;
|
||||
|
||||
/**
|
||||
* Plot Series
|
||||
* Plot Series.
|
||||
*
|
||||
* @var array of DataSeries
|
||||
*/
|
||||
private $plotSeries = [];
|
||||
|
||||
/**
|
||||
* Create a new PlotArea
|
||||
* Create a new PlotArea.
|
||||
*
|
||||
* @param mixed $plotSeries
|
||||
*/
|
||||
public function __construct(Layout $layout = null, $plotSeries = [])
|
||||
{
|
||||
|
@ -49,7 +52,7 @@ class PlotArea
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Layout
|
||||
* Get Layout.
|
||||
*
|
||||
* @return Layout
|
||||
*/
|
||||
|
@ -59,7 +62,7 @@ class PlotArea
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Number of Plot Groups
|
||||
* Get Number of Plot Groups.
|
||||
*
|
||||
* @return array of DataSeries
|
||||
*/
|
||||
|
@ -69,7 +72,7 @@ class PlotArea
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Number of Plot Series
|
||||
* Get Number of Plot Series.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
@ -84,7 +87,7 @@ class PlotArea
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Plot Series
|
||||
* Get Plot Series.
|
||||
*
|
||||
* @return array of DataSeries
|
||||
*/
|
||||
|
@ -94,7 +97,9 @@ class PlotArea
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Plot Series by Index
|
||||
* Get Plot Series by Index.
|
||||
*
|
||||
* @param mixed $index
|
||||
*
|
||||
* @return DataSeries
|
||||
*/
|
||||
|
@ -104,9 +109,11 @@ class PlotArea
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Plot Series
|
||||
* Set Plot Series.
|
||||
*
|
||||
* @param DataSeries[]
|
||||
* @param mixed $plotSeries
|
||||
*
|
||||
* @return PlotArea
|
||||
*/
|
||||
public function setPlotSeries($plotSeries = [])
|
||||
|
|
|
@ -6,114 +6,109 @@ namespace PhpOffice\PhpSpreadsheet\Chart;
|
|||
* Created by PhpStorm.
|
||||
* User: nhw2h8s
|
||||
* Date: 7/2/14
|
||||
* Time: 5:45 PM
|
||||
* Time: 5:45 PM.
|
||||
*/
|
||||
abstract class Properties
|
||||
{
|
||||
const
|
||||
EXCEL_COLOR_TYPE_STANDARD = 'prstClr',
|
||||
EXCEL_COLOR_TYPE_SCHEME = 'schemeClr',
|
||||
EXCEL_COLOR_TYPE_ARGB = 'srgbClr';
|
||||
EXCEL_COLOR_TYPE_STANDARD = 'prstClr';
|
||||
const EXCEL_COLOR_TYPE_SCHEME = 'schemeClr';
|
||||
const EXCEL_COLOR_TYPE_ARGB = 'srgbClr';
|
||||
|
||||
const
|
||||
AXIS_LABELS_LOW = 'low',
|
||||
AXIS_LABELS_HIGH = 'high',
|
||||
AXIS_LABELS_NEXT_TO = 'nextTo',
|
||||
AXIS_LABELS_NONE = 'none';
|
||||
AXIS_LABELS_LOW = 'low';
|
||||
const AXIS_LABELS_HIGH = 'high';
|
||||
const AXIS_LABELS_NEXT_TO = 'nextTo';
|
||||
const AXIS_LABELS_NONE = 'none';
|
||||
|
||||
const
|
||||
TICK_MARK_NONE = 'none',
|
||||
TICK_MARK_INSIDE = 'in',
|
||||
TICK_MARK_OUTSIDE = 'out',
|
||||
TICK_MARK_CROSS = 'cross';
|
||||
TICK_MARK_NONE = 'none';
|
||||
const TICK_MARK_INSIDE = 'in';
|
||||
const TICK_MARK_OUTSIDE = 'out';
|
||||
const TICK_MARK_CROSS = 'cross';
|
||||
|
||||
const
|
||||
HORIZONTAL_CROSSES_AUTOZERO = 'autoZero',
|
||||
HORIZONTAL_CROSSES_MAXIMUM = 'max';
|
||||
HORIZONTAL_CROSSES_AUTOZERO = 'autoZero';
|
||||
const HORIZONTAL_CROSSES_MAXIMUM = 'max';
|
||||
|
||||
const
|
||||
FORMAT_CODE_GENERAL = 'General',
|
||||
FORMAT_CODE_NUMBER = '#,##0.00',
|
||||
FORMAT_CODE_CURRENCY = '$#,##0.00',
|
||||
FORMAT_CODE_ACCOUNTING = '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)',
|
||||
FORMAT_CODE_DATE = 'm/d/yyyy',
|
||||
FORMAT_CODE_TIME = '[$-F400]h:mm:ss AM/PM',
|
||||
FORMAT_CODE_PERCENTAGE = '0.00%',
|
||||
FORMAT_CODE_FRACTION = '# ?/?',
|
||||
FORMAT_CODE_SCIENTIFIC = '0.00E+00',
|
||||
FORMAT_CODE_TEXT = '@',
|
||||
FORMAT_CODE_SPECIAL = '00000';
|
||||
FORMAT_CODE_GENERAL = 'General';
|
||||
const FORMAT_CODE_NUMBER = '#,##0.00';
|
||||
const FORMAT_CODE_CURRENCY = '$#,##0.00';
|
||||
const FORMAT_CODE_ACCOUNTING = '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)';
|
||||
const FORMAT_CODE_DATE = 'm/d/yyyy';
|
||||
const FORMAT_CODE_TIME = '[$-F400]h:mm:ss AM/PM';
|
||||
const FORMAT_CODE_PERCENTAGE = '0.00%';
|
||||
const FORMAT_CODE_FRACTION = '# ?/?';
|
||||
const FORMAT_CODE_SCIENTIFIC = '0.00E+00';
|
||||
const FORMAT_CODE_TEXT = '@';
|
||||
const FORMAT_CODE_SPECIAL = '00000';
|
||||
|
||||
const
|
||||
ORIENTATION_NORMAL = 'minMax',
|
||||
ORIENTATION_REVERSED = 'maxMin';
|
||||
ORIENTATION_NORMAL = 'minMax';
|
||||
const ORIENTATION_REVERSED = 'maxMin';
|
||||
|
||||
const
|
||||
LINE_STYLE_COMPOUND_SIMPLE = 'sng',
|
||||
LINE_STYLE_COMPOUND_DOUBLE = 'dbl',
|
||||
LINE_STYLE_COMPOUND_THICKTHIN = 'thickThin',
|
||||
LINE_STYLE_COMPOUND_THINTHICK = 'thinThick',
|
||||
LINE_STYLE_COMPOUND_TRIPLE = 'tri',
|
||||
|
||||
LINE_STYLE_DASH_SOLID = 'solid',
|
||||
LINE_STYLE_DASH_ROUND_DOT = 'sysDot',
|
||||
LINE_STYLE_DASH_SQUERE_DOT = 'sysDash',
|
||||
LINE_STYPE_DASH_DASH = 'dash',
|
||||
LINE_STYLE_DASH_DASH_DOT = 'dashDot',
|
||||
LINE_STYLE_DASH_LONG_DASH = 'lgDash',
|
||||
LINE_STYLE_DASH_LONG_DASH_DOT = 'lgDashDot',
|
||||
LINE_STYLE_DASH_LONG_DASH_DOT_DOT = 'lgDashDotDot',
|
||||
|
||||
LINE_STYLE_CAP_SQUARE = 'sq',
|
||||
LINE_STYLE_CAP_ROUND = 'rnd',
|
||||
LINE_STYLE_CAP_FLAT = 'flat',
|
||||
|
||||
LINE_STYLE_JOIN_ROUND = 'bevel',
|
||||
LINE_STYLE_JOIN_MITER = 'miter',
|
||||
LINE_STYLE_JOIN_BEVEL = 'bevel',
|
||||
|
||||
LINE_STYLE_ARROW_TYPE_NOARROW = null,
|
||||
LINE_STYLE_ARROW_TYPE_ARROW = 'triangle',
|
||||
LINE_STYLE_ARROW_TYPE_OPEN = 'arrow',
|
||||
LINE_STYLE_ARROW_TYPE_STEALTH = 'stealth',
|
||||
LINE_STYLE_ARROW_TYPE_DIAMOND = 'diamond',
|
||||
LINE_STYLE_ARROW_TYPE_OVAL = 'oval',
|
||||
|
||||
LINE_STYLE_ARROW_SIZE_1 = 1,
|
||||
LINE_STYLE_ARROW_SIZE_2 = 2,
|
||||
LINE_STYLE_ARROW_SIZE_3 = 3,
|
||||
LINE_STYLE_ARROW_SIZE_4 = 4,
|
||||
LINE_STYLE_ARROW_SIZE_5 = 5,
|
||||
LINE_STYLE_ARROW_SIZE_6 = 6,
|
||||
LINE_STYLE_ARROW_SIZE_7 = 7,
|
||||
LINE_STYLE_ARROW_SIZE_8 = 8,
|
||||
LINE_STYLE_ARROW_SIZE_9 = 9;
|
||||
LINE_STYLE_COMPOUND_SIMPLE = 'sng';
|
||||
const LINE_STYLE_COMPOUND_DOUBLE = 'dbl';
|
||||
const LINE_STYLE_COMPOUND_THICKTHIN = 'thickThin';
|
||||
const LINE_STYLE_COMPOUND_THINTHICK = 'thinThick';
|
||||
const LINE_STYLE_COMPOUND_TRIPLE = 'tri';
|
||||
const LINE_STYLE_DASH_SOLID = 'solid';
|
||||
const LINE_STYLE_DASH_ROUND_DOT = 'sysDot';
|
||||
const LINE_STYLE_DASH_SQUERE_DOT = 'sysDash';
|
||||
const LINE_STYPE_DASH_DASH = 'dash';
|
||||
const LINE_STYLE_DASH_DASH_DOT = 'dashDot';
|
||||
const LINE_STYLE_DASH_LONG_DASH = 'lgDash';
|
||||
const LINE_STYLE_DASH_LONG_DASH_DOT = 'lgDashDot';
|
||||
const LINE_STYLE_DASH_LONG_DASH_DOT_DOT = 'lgDashDotDot';
|
||||
const LINE_STYLE_CAP_SQUARE = 'sq';
|
||||
const LINE_STYLE_CAP_ROUND = 'rnd';
|
||||
const LINE_STYLE_CAP_FLAT = 'flat';
|
||||
const LINE_STYLE_JOIN_ROUND = 'bevel';
|
||||
const LINE_STYLE_JOIN_MITER = 'miter';
|
||||
const LINE_STYLE_JOIN_BEVEL = 'bevel';
|
||||
const LINE_STYLE_ARROW_TYPE_NOARROW = null;
|
||||
const LINE_STYLE_ARROW_TYPE_ARROW = 'triangle';
|
||||
const LINE_STYLE_ARROW_TYPE_OPEN = 'arrow';
|
||||
const LINE_STYLE_ARROW_TYPE_STEALTH = 'stealth';
|
||||
const LINE_STYLE_ARROW_TYPE_DIAMOND = 'diamond';
|
||||
const LINE_STYLE_ARROW_TYPE_OVAL = 'oval';
|
||||
const LINE_STYLE_ARROW_SIZE_1 = 1;
|
||||
const LINE_STYLE_ARROW_SIZE_2 = 2;
|
||||
const LINE_STYLE_ARROW_SIZE_3 = 3;
|
||||
const LINE_STYLE_ARROW_SIZE_4 = 4;
|
||||
const LINE_STYLE_ARROW_SIZE_5 = 5;
|
||||
const LINE_STYLE_ARROW_SIZE_6 = 6;
|
||||
const LINE_STYLE_ARROW_SIZE_7 = 7;
|
||||
const LINE_STYLE_ARROW_SIZE_8 = 8;
|
||||
const LINE_STYLE_ARROW_SIZE_9 = 9;
|
||||
|
||||
const
|
||||
SHADOW_PRESETS_NOSHADOW = null,
|
||||
SHADOW_PRESETS_OUTER_BOTTTOM_RIGHT = 1,
|
||||
SHADOW_PRESETS_OUTER_BOTTOM = 2,
|
||||
SHADOW_PRESETS_OUTER_BOTTOM_LEFT = 3,
|
||||
SHADOW_PRESETS_OUTER_RIGHT = 4,
|
||||
SHADOW_PRESETS_OUTER_CENTER = 5,
|
||||
SHADOW_PRESETS_OUTER_LEFT = 6,
|
||||
SHADOW_PRESETS_OUTER_TOP_RIGHT = 7,
|
||||
SHADOW_PRESETS_OUTER_TOP = 8,
|
||||
SHADOW_PRESETS_OUTER_TOP_LEFT = 9,
|
||||
SHADOW_PRESETS_INNER_BOTTTOM_RIGHT = 10,
|
||||
SHADOW_PRESETS_INNER_BOTTOM = 11,
|
||||
SHADOW_PRESETS_INNER_BOTTOM_LEFT = 12,
|
||||
SHADOW_PRESETS_INNER_RIGHT = 13,
|
||||
SHADOW_PRESETS_INNER_CENTER = 14,
|
||||
SHADOW_PRESETS_INNER_LEFT = 15,
|
||||
SHADOW_PRESETS_INNER_TOP_RIGHT = 16,
|
||||
SHADOW_PRESETS_INNER_TOP = 17,
|
||||
SHADOW_PRESETS_INNER_TOP_LEFT = 18,
|
||||
SHADOW_PRESETS_PERSPECTIVE_BELOW = 19,
|
||||
SHADOW_PRESETS_PERSPECTIVE_UPPER_RIGHT = 20,
|
||||
SHADOW_PRESETS_PERSPECTIVE_UPPER_LEFT = 21,
|
||||
SHADOW_PRESETS_PERSPECTIVE_LOWER_RIGHT = 22,
|
||||
SHADOW_PRESETS_PERSPECTIVE_LOWER_LEFT = 23;
|
||||
SHADOW_PRESETS_NOSHADOW = null;
|
||||
const SHADOW_PRESETS_OUTER_BOTTTOM_RIGHT = 1;
|
||||
const SHADOW_PRESETS_OUTER_BOTTOM = 2;
|
||||
const SHADOW_PRESETS_OUTER_BOTTOM_LEFT = 3;
|
||||
const SHADOW_PRESETS_OUTER_RIGHT = 4;
|
||||
const SHADOW_PRESETS_OUTER_CENTER = 5;
|
||||
const SHADOW_PRESETS_OUTER_LEFT = 6;
|
||||
const SHADOW_PRESETS_OUTER_TOP_RIGHT = 7;
|
||||
const SHADOW_PRESETS_OUTER_TOP = 8;
|
||||
const SHADOW_PRESETS_OUTER_TOP_LEFT = 9;
|
||||
const SHADOW_PRESETS_INNER_BOTTTOM_RIGHT = 10;
|
||||
const SHADOW_PRESETS_INNER_BOTTOM = 11;
|
||||
const SHADOW_PRESETS_INNER_BOTTOM_LEFT = 12;
|
||||
const SHADOW_PRESETS_INNER_RIGHT = 13;
|
||||
const SHADOW_PRESETS_INNER_CENTER = 14;
|
||||
const SHADOW_PRESETS_INNER_LEFT = 15;
|
||||
const SHADOW_PRESETS_INNER_TOP_RIGHT = 16;
|
||||
const SHADOW_PRESETS_INNER_TOP = 17;
|
||||
const SHADOW_PRESETS_INNER_TOP_LEFT = 18;
|
||||
const SHADOW_PRESETS_PERSPECTIVE_BELOW = 19;
|
||||
const SHADOW_PRESETS_PERSPECTIVE_UPPER_RIGHT = 20;
|
||||
const SHADOW_PRESETS_PERSPECTIVE_UPPER_LEFT = 21;
|
||||
const SHADOW_PRESETS_PERSPECTIVE_LOWER_RIGHT = 22;
|
||||
const SHADOW_PRESETS_PERSPECTIVE_LOWER_LEFT = 23;
|
||||
|
||||
/**
|
||||
* @param float $width
|
||||
|
@ -359,14 +354,12 @@ abstract class Properties
|
|||
$reference = &$properties;
|
||||
if (!is_array($elements)) {
|
||||
return $reference[$elements];
|
||||
} else {
|
||||
}
|
||||
foreach ($elements as $keys) {
|
||||
$reference = &$reference[$keys];
|
||||
}
|
||||
|
||||
return $reference;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Chart\Renderer;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart\Renderer;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -845,7 +846,7 @@ class JpGraph
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a new jpgraph
|
||||
* Create a new jpgraph.
|
||||
*/
|
||||
public function __construct(\PhpOffice\PhpSpreadsheet\Chart $chart)
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Chart;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,27 +20,30 @@ namespace PhpOffice\PhpSpreadsheet\Chart;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Title
|
||||
{
|
||||
/**
|
||||
* Title Caption
|
||||
* Title Caption.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $caption = null;
|
||||
|
||||
/**
|
||||
* Title Layout
|
||||
* Title Layout.
|
||||
*
|
||||
* @var Layout
|
||||
*/
|
||||
private $layout = null;
|
||||
|
||||
/**
|
||||
* Create a new Title
|
||||
* Create a new Title.
|
||||
*
|
||||
* @param null|mixed $caption
|
||||
*/
|
||||
public function __construct($caption = null, Layout $layout = null)
|
||||
{
|
||||
|
@ -49,7 +52,7 @@ class Title
|
|||
}
|
||||
|
||||
/**
|
||||
* Get caption
|
||||
* Get caption.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -59,9 +62,10 @@ class Title
|
|||
}
|
||||
|
||||
/**
|
||||
* Set caption
|
||||
* Set caption.
|
||||
*
|
||||
* @param string $caption
|
||||
*
|
||||
* @return Title
|
||||
*/
|
||||
public function setCaption($caption = null)
|
||||
|
@ -72,7 +76,7 @@ class Title
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Layout
|
||||
* Get Layout.
|
||||
*
|
||||
* @return Layout
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,76 +20,77 @@ namespace PhpOffice\PhpSpreadsheet;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Comment implements IComparable
|
||||
{
|
||||
/**
|
||||
* Author
|
||||
* Author.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $author;
|
||||
|
||||
/**
|
||||
* Rich text comment
|
||||
* Rich text comment.
|
||||
*
|
||||
* @var RichText
|
||||
*/
|
||||
private $text;
|
||||
|
||||
/**
|
||||
* Comment width (CSS style, i.e. XXpx or YYpt)
|
||||
* Comment width (CSS style, i.e. XXpx or YYpt).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $width = '96pt';
|
||||
|
||||
/**
|
||||
* Left margin (CSS style, i.e. XXpx or YYpt)
|
||||
* Left margin (CSS style, i.e. XXpx or YYpt).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $marginLeft = '59.25pt';
|
||||
|
||||
/**
|
||||
* Top margin (CSS style, i.e. XXpx or YYpt)
|
||||
* Top margin (CSS style, i.e. XXpx or YYpt).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $marginTop = '1.5pt';
|
||||
|
||||
/**
|
||||
* Visible
|
||||
* Visible.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $visible = false;
|
||||
|
||||
/**
|
||||
* Comment height (CSS style, i.e. XXpx or YYpt)
|
||||
* Comment height (CSS style, i.e. XXpx or YYpt).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $height = '55.5pt';
|
||||
|
||||
/**
|
||||
* Comment fill color
|
||||
* Comment fill color.
|
||||
*
|
||||
* @var Style\Color
|
||||
*/
|
||||
private $fillColor;
|
||||
|
||||
/**
|
||||
* Alignment
|
||||
* Alignment.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $alignment;
|
||||
|
||||
/**
|
||||
* Create a new Comment
|
||||
* Create a new Comment.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
|
@ -103,7 +104,7 @@ class Comment implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Author
|
||||
* Get Author.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -113,9 +114,10 @@ class Comment implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Author
|
||||
* Set Author.
|
||||
*
|
||||
* @param string $pValue
|
||||
*
|
||||
* @return Comment
|
||||
*/
|
||||
public function setAuthor($pValue = '')
|
||||
|
@ -126,7 +128,7 @@ class Comment implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Rich text comment
|
||||
* Get Rich text comment.
|
||||
*
|
||||
* @return RichText
|
||||
*/
|
||||
|
@ -136,9 +138,10 @@ class Comment implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Rich text comment
|
||||
* Set Rich text comment.
|
||||
*
|
||||
* @param RichText $pValue
|
||||
*
|
||||
* @return Comment
|
||||
*/
|
||||
public function setText(RichText $pValue)
|
||||
|
@ -149,7 +152,7 @@ class Comment implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get comment width (CSS style, i.e. XXpx or YYpt)
|
||||
* Get comment width (CSS style, i.e. XXpx or YYpt).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -159,9 +162,10 @@ class Comment implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set comment width (CSS style, i.e. XXpx or YYpt)
|
||||
* Set comment width (CSS style, i.e. XXpx or YYpt).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return Comment
|
||||
*/
|
||||
public function setWidth($value = '96pt')
|
||||
|
@ -172,7 +176,7 @@ class Comment implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get comment height (CSS style, i.e. XXpx or YYpt)
|
||||
* Get comment height (CSS style, i.e. XXpx or YYpt).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -182,9 +186,10 @@ class Comment implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set comment height (CSS style, i.e. XXpx or YYpt)
|
||||
* Set comment height (CSS style, i.e. XXpx or YYpt).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return Comment
|
||||
*/
|
||||
public function setHeight($value = '55.5pt')
|
||||
|
@ -195,7 +200,7 @@ class Comment implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get left margin (CSS style, i.e. XXpx or YYpt)
|
||||
* Get left margin (CSS style, i.e. XXpx or YYpt).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -205,9 +210,10 @@ class Comment implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set left margin (CSS style, i.e. XXpx or YYpt)
|
||||
* Set left margin (CSS style, i.e. XXpx or YYpt).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return Comment
|
||||
*/
|
||||
public function setMarginLeft($value = '59.25pt')
|
||||
|
@ -218,7 +224,7 @@ class Comment implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get top margin (CSS style, i.e. XXpx or YYpt)
|
||||
* Get top margin (CSS style, i.e. XXpx or YYpt).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -228,9 +234,10 @@ class Comment implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set top margin (CSS style, i.e. XXpx or YYpt)
|
||||
* Set top margin (CSS style, i.e. XXpx or YYpt).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return Comment
|
||||
*/
|
||||
public function setMarginTop($value = '1.5pt')
|
||||
|
@ -251,9 +258,10 @@ class Comment implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set comment default visibility
|
||||
* Set comment default visibility.
|
||||
*
|
||||
* @param bool $value
|
||||
*
|
||||
* @return Comment
|
||||
*/
|
||||
public function setVisible($value = false)
|
||||
|
@ -264,7 +272,7 @@ class Comment implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get fill color
|
||||
* Get fill color.
|
||||
*
|
||||
* @return Style\Color
|
||||
*/
|
||||
|
@ -274,9 +282,10 @@ class Comment implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Alignment
|
||||
* Set Alignment.
|
||||
*
|
||||
* @param string $pValue
|
||||
*
|
||||
* @return Comment
|
||||
*/
|
||||
public function setAlignment($pValue = Style\Alignment::HORIZONTAL_GENERAL)
|
||||
|
@ -287,7 +296,7 @@ class Comment implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Alignment
|
||||
* Get Alignment.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -297,7 +306,7 @@ class Comment implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
* Get hash code.
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
|
@ -333,7 +342,7 @@ class Comment implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Convert to string
|
||||
* Convert to string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Document;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Document;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -34,91 +35,91 @@ class Properties
|
|||
const PROPERTY_TYPE_UNKNOWN = 'u';
|
||||
|
||||
/**
|
||||
* Creator
|
||||
* Creator.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $creator = 'Unknown Creator';
|
||||
|
||||
/**
|
||||
* LastModifiedBy
|
||||
* LastModifiedBy.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $lastModifiedBy;
|
||||
|
||||
/**
|
||||
* Created
|
||||
* Created.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $created;
|
||||
|
||||
/**
|
||||
* Modified
|
||||
* Modified.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $modified;
|
||||
|
||||
/**
|
||||
* Title
|
||||
* Title.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $title = 'Untitled Spreadsheet';
|
||||
|
||||
/**
|
||||
* Description
|
||||
* Description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $description = '';
|
||||
|
||||
/**
|
||||
* Subject
|
||||
* Subject.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $subject = '';
|
||||
|
||||
/**
|
||||
* Keywords
|
||||
* Keywords.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $keywords = '';
|
||||
|
||||
/**
|
||||
* Category
|
||||
* Category.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $category = '';
|
||||
|
||||
/**
|
||||
* Manager
|
||||
* Manager.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $manager = '';
|
||||
|
||||
/**
|
||||
* Company
|
||||
* Company.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $company = 'Microsoft Corporation';
|
||||
|
||||
/**
|
||||
* Custom Properties
|
||||
* Custom Properties.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $customProperties = [];
|
||||
|
||||
/**
|
||||
* Create a new Document Properties instance
|
||||
* Create a new Document Properties instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -129,7 +130,7 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Creator
|
||||
* Get Creator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -139,9 +140,10 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Creator
|
||||
* Set Creator.
|
||||
*
|
||||
* @param string $pValue
|
||||
*
|
||||
* @return Properties
|
||||
*/
|
||||
public function setCreator($pValue = '')
|
||||
|
@ -152,7 +154,7 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Last Modified By
|
||||
* Get Last Modified By.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -162,9 +164,10 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Last Modified By
|
||||
* Set Last Modified By.
|
||||
*
|
||||
* @param string $pValue
|
||||
*
|
||||
* @return Properties
|
||||
*/
|
||||
public function setLastModifiedBy($pValue = '')
|
||||
|
@ -175,7 +178,7 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Created
|
||||
* Get Created.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
@ -185,9 +188,10 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Created
|
||||
* Set Created.
|
||||
*
|
||||
* @param datetime $pValue
|
||||
*
|
||||
* @return Properties
|
||||
*/
|
||||
public function setCreated($pValue = null)
|
||||
|
@ -196,7 +200,7 @@ class Properties
|
|||
$pValue = time();
|
||||
} elseif (is_string($pValue)) {
|
||||
if (is_numeric($pValue)) {
|
||||
$pValue = intval($pValue);
|
||||
$pValue = (int) $pValue;
|
||||
} else {
|
||||
$pValue = strtotime($pValue);
|
||||
}
|
||||
|
@ -208,7 +212,7 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Modified
|
||||
* Get Modified.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
@ -218,9 +222,10 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Modified
|
||||
* Set Modified.
|
||||
*
|
||||
* @param datetime $pValue
|
||||
*
|
||||
* @return Properties
|
||||
*/
|
||||
public function setModified($pValue = null)
|
||||
|
@ -229,7 +234,7 @@ class Properties
|
|||
$pValue = time();
|
||||
} elseif (is_string($pValue)) {
|
||||
if (is_numeric($pValue)) {
|
||||
$pValue = intval($pValue);
|
||||
$pValue = (int) $pValue;
|
||||
} else {
|
||||
$pValue = strtotime($pValue);
|
||||
}
|
||||
|
@ -241,7 +246,7 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Title
|
||||
* Get Title.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -251,9 +256,10 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Title
|
||||
* Set Title.
|
||||
*
|
||||
* @param string $pValue
|
||||
*
|
||||
* @return Properties
|
||||
*/
|
||||
public function setTitle($pValue = '')
|
||||
|
@ -264,7 +270,7 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Description
|
||||
* Get Description.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -274,9 +280,10 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Description
|
||||
* Set Description.
|
||||
*
|
||||
* @param string $pValue
|
||||
*
|
||||
* @return Properties
|
||||
*/
|
||||
public function setDescription($pValue = '')
|
||||
|
@ -287,7 +294,7 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Subject
|
||||
* Get Subject.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -297,9 +304,10 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Subject
|
||||
* Set Subject.
|
||||
*
|
||||
* @param string $pValue
|
||||
*
|
||||
* @return Properties
|
||||
*/
|
||||
public function setSubject($pValue = '')
|
||||
|
@ -310,7 +318,7 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Keywords
|
||||
* Get Keywords.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -320,9 +328,10 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Keywords
|
||||
* Set Keywords.
|
||||
*
|
||||
* @param string $pValue
|
||||
*
|
||||
* @return Properties
|
||||
*/
|
||||
public function setKeywords($pValue = '')
|
||||
|
@ -333,7 +342,7 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Category
|
||||
* Get Category.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -343,9 +352,10 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Category
|
||||
* Set Category.
|
||||
*
|
||||
* @param string $pValue
|
||||
*
|
||||
* @return Properties
|
||||
*/
|
||||
public function setCategory($pValue = '')
|
||||
|
@ -356,7 +366,7 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Company
|
||||
* Get Company.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -366,9 +376,10 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Company
|
||||
* Set Company.
|
||||
*
|
||||
* @param string $pValue
|
||||
*
|
||||
* @return Properties
|
||||
*/
|
||||
public function setCompany($pValue = '')
|
||||
|
@ -379,7 +390,7 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Manager
|
||||
* Get Manager.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -389,9 +400,10 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Manager
|
||||
* Set Manager.
|
||||
*
|
||||
* @param string $pValue
|
||||
*
|
||||
* @return Properties
|
||||
*/
|
||||
public function setManager($pValue = '')
|
||||
|
@ -402,7 +414,7 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a List of Custom Property Names
|
||||
* Get a List of Custom Property Names.
|
||||
*
|
||||
* @return array of string
|
||||
*/
|
||||
|
@ -412,9 +424,10 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Check if a Custom Property is defined
|
||||
* Check if a Custom Property is defined.
|
||||
*
|
||||
* @param string $propertyName
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isCustomPropertySet($propertyName)
|
||||
|
@ -423,9 +436,10 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a Custom Property Value
|
||||
* Get a Custom Property Value.
|
||||
*
|
||||
* @param string $propertyName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCustomPropertyValue($propertyName)
|
||||
|
@ -436,9 +450,10 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a Custom Property Type
|
||||
* Get a Custom Property Type.
|
||||
*
|
||||
* @param string $propertyName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCustomPropertyType($propertyName)
|
||||
|
@ -449,7 +464,7 @@ class Properties
|
|||
}
|
||||
|
||||
/**
|
||||
* Set a Custom Property
|
||||
* Set a Custom Property.
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @param mixed $propertyValue
|
||||
|
@ -459,6 +474,7 @@ class Properties
|
|||
* 's' : String
|
||||
* 'd' : Date/Time
|
||||
* 'b' : Boolean
|
||||
*
|
||||
* @return Properties
|
||||
*/
|
||||
public function setCustomProperty($propertyName, $propertyValue = '', $propertyType = null)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Document;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,48 +20,49 @@ namespace PhpOffice\PhpSpreadsheet\Document;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Security
|
||||
{
|
||||
/**
|
||||
* LockRevision
|
||||
* LockRevision.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $lockRevision = false;
|
||||
|
||||
/**
|
||||
* LockStructure
|
||||
* LockStructure.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $lockStructure = false;
|
||||
|
||||
/**
|
||||
* LockWindows
|
||||
* LockWindows.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $lockWindows = false;
|
||||
|
||||
/**
|
||||
* RevisionsPassword
|
||||
* RevisionsPassword.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $revisionsPassword = '';
|
||||
|
||||
/**
|
||||
* WorkbookPassword
|
||||
* WorkbookPassword.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $workbookPassword = '';
|
||||
|
||||
/**
|
||||
* Create a new Document Security instance
|
||||
* Create a new Document Security instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -80,7 +81,7 @@ class Security
|
|||
}
|
||||
|
||||
/**
|
||||
* Get LockRevision
|
||||
* Get LockRevision.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -90,9 +91,10 @@ class Security
|
|||
}
|
||||
|
||||
/**
|
||||
* Set LockRevision
|
||||
* Set LockRevision.
|
||||
*
|
||||
* @param bool $pValue
|
||||
*
|
||||
* @return Security
|
||||
*/
|
||||
public function setLockRevision($pValue = false)
|
||||
|
@ -103,7 +105,7 @@ class Security
|
|||
}
|
||||
|
||||
/**
|
||||
* Get LockStructure
|
||||
* Get LockStructure.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -113,9 +115,10 @@ class Security
|
|||
}
|
||||
|
||||
/**
|
||||
* Set LockStructure
|
||||
* Set LockStructure.
|
||||
*
|
||||
* @param bool $pValue
|
||||
*
|
||||
* @return Security
|
||||
*/
|
||||
public function setLockStructure($pValue = false)
|
||||
|
@ -126,7 +129,7 @@ class Security
|
|||
}
|
||||
|
||||
/**
|
||||
* Get LockWindows
|
||||
* Get LockWindows.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -136,9 +139,10 @@ class Security
|
|||
}
|
||||
|
||||
/**
|
||||
* Set LockWindows
|
||||
* Set LockWindows.
|
||||
*
|
||||
* @param bool $pValue
|
||||
*
|
||||
* @return Security
|
||||
*/
|
||||
public function setLockWindows($pValue = false)
|
||||
|
@ -149,7 +153,7 @@ class Security
|
|||
}
|
||||
|
||||
/**
|
||||
* Get RevisionsPassword (hashed)
|
||||
* Get RevisionsPassword (hashed).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -159,10 +163,11 @@ class Security
|
|||
}
|
||||
|
||||
/**
|
||||
* Set RevisionsPassword
|
||||
* Set RevisionsPassword.
|
||||
*
|
||||
* @param string $pValue
|
||||
* @param bool $pAlreadyHashed If the password has already been hashed, set this to true
|
||||
*
|
||||
* @return Security
|
||||
*/
|
||||
public function setRevisionsPassword($pValue = '', $pAlreadyHashed = false)
|
||||
|
@ -176,7 +181,7 @@ class Security
|
|||
}
|
||||
|
||||
/**
|
||||
* Get WorkbookPassword (hashed)
|
||||
* Get WorkbookPassword (hashed).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -186,10 +191,11 @@ class Security
|
|||
}
|
||||
|
||||
/**
|
||||
* Set WorkbookPassword
|
||||
* Set WorkbookPassword.
|
||||
*
|
||||
* @param string $pValue
|
||||
* @param bool $pAlreadyHashed If the password has already been hashed, set this to true
|
||||
*
|
||||
* @return Security
|
||||
*/
|
||||
public function setWorkbookPassword($pValue = '', $pAlreadyHashed = false)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Exception extends \Exception
|
||||
{
|
||||
/**
|
||||
* Error handler callback
|
||||
* Error handler callback.
|
||||
*
|
||||
* @param mixed $code
|
||||
* @param mixed $string
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,29 +20,31 @@ namespace PhpOffice\PhpSpreadsheet;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class HashTable
|
||||
{
|
||||
/**
|
||||
* HashTable elements
|
||||
* HashTable elements.
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $items = [];
|
||||
|
||||
/**
|
||||
* HashTable key map
|
||||
* HashTable key map.
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $keyMap = [];
|
||||
|
||||
/**
|
||||
* Create a new \PhpOffice\PhpSpreadsheet\HashTable
|
||||
* Create a new \PhpOffice\PhpSpreadsheet\HashTable.
|
||||
*
|
||||
* @param IComparable[] $pSource Optional source array to create HashTable from
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct($pSource = null)
|
||||
|
@ -54,9 +56,10 @@ class HashTable
|
|||
}
|
||||
|
||||
/**
|
||||
* Add HashTable items from source
|
||||
* Add HashTable items from source.
|
||||
*
|
||||
* @param IComparable[] $pSource Source array to create HashTable from
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function addFromSource($pSource = null)
|
||||
|
@ -74,9 +77,10 @@ class HashTable
|
|||
}
|
||||
|
||||
/**
|
||||
* Add HashTable item
|
||||
* Add HashTable item.
|
||||
*
|
||||
* @param IComparable $pSource Item to add
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function add(IComparable $pSource = null)
|
||||
|
@ -89,9 +93,10 @@ class HashTable
|
|||
}
|
||||
|
||||
/**
|
||||
* Remove HashTable item
|
||||
* Remove HashTable item.
|
||||
*
|
||||
* @param IComparable $pSource Item to remove
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function remove(IComparable $pSource = null)
|
||||
|
@ -115,7 +120,7 @@ class HashTable
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear HashTable
|
||||
* Clear HashTable.
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
|
@ -124,7 +129,7 @@ class HashTable
|
|||
}
|
||||
|
||||
/**
|
||||
* Count
|
||||
* Count.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
@ -134,9 +139,10 @@ class HashTable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get index for hash code
|
||||
* Get index for hash code.
|
||||
*
|
||||
* @param string $pHashCode
|
||||
*
|
||||
* @return int Index
|
||||
*/
|
||||
public function getIndexForHashCode($pHashCode = '')
|
||||
|
@ -145,9 +151,10 @@ class HashTable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get by index
|
||||
* Get by index.
|
||||
*
|
||||
* @param int $pIndex
|
||||
*
|
||||
* @return IComparable
|
||||
*/
|
||||
public function getByIndex($pIndex = 0)
|
||||
|
@ -160,9 +167,10 @@ class HashTable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get by hashcode
|
||||
* Get by hashcode.
|
||||
*
|
||||
* @param string $pHashCode
|
||||
*
|
||||
* @return IComparable
|
||||
*/
|
||||
public function getByHashCode($pHashCode = '')
|
||||
|
@ -175,7 +183,7 @@ class HashTable
|
|||
}
|
||||
|
||||
/**
|
||||
* HashTable to array
|
||||
* HashTable to array.
|
||||
*
|
||||
* @return IComparable[]
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@ use DOMNode;
|
|||
use DOMText;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -25,6 +25,7 @@ use DOMText;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,8 @@ namespace PhpOffice\PhpSpreadsheet\Helper;
|
|||
class Migrator
|
||||
{
|
||||
/**
|
||||
* Return the ordered mapping from old PHPExcel class names to new PhpSpreadsheet one
|
||||
* Return the ordered mapping from old PHPExcel class names to new PhpSpreadsheet one.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getMapping()
|
||||
|
@ -231,7 +232,8 @@ class Migrator
|
|||
}
|
||||
|
||||
/**
|
||||
* Search in all files in given directory
|
||||
* Search in all files in given directory.
|
||||
*
|
||||
* @param string $path
|
||||
*/
|
||||
private function recursiveReplace($path)
|
||||
|
|
|
@ -8,7 +8,8 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|||
class Sample
|
||||
{
|
||||
/**
|
||||
* Returns wether we run on CLI or browser
|
||||
* Returns wether we run on CLI or browser.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isCli()
|
||||
|
@ -17,7 +18,8 @@ class Sample
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the filename currently being executed
|
||||
* Return the filename currently being executed.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getScriptFilename()
|
||||
|
@ -26,7 +28,8 @@ class Sample
|
|||
}
|
||||
|
||||
/**
|
||||
* Wether we are executing the index page
|
||||
* Wether we are executing the index page.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isIndex()
|
||||
|
@ -35,7 +38,8 @@ class Sample
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the page title
|
||||
* Return the page title.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPageTitle()
|
||||
|
@ -44,7 +48,8 @@ class Sample
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the page heading
|
||||
* Return the page heading.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPageHeading()
|
||||
|
@ -53,7 +58,8 @@ class Sample
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all known samples
|
||||
* Returns an array of all known samples.
|
||||
*
|
||||
* @return string[] [$name => $path]
|
||||
*/
|
||||
public function getSamples()
|
||||
|
@ -72,7 +78,7 @@ class Sample
|
|||
}
|
||||
|
||||
/**
|
||||
* Write documents
|
||||
* Write documents.
|
||||
*
|
||||
* @param Spreadsheet $spreadsheet
|
||||
* @param string $filename
|
||||
|
@ -100,7 +106,8 @@ class Sample
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the temporary directory and make sure it exists
|
||||
* Returns the temporary directory and make sure it exists.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getTemporaryFolder()
|
||||
|
@ -114,9 +121,11 @@ class Sample
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the filename that should be used for sample output
|
||||
* Returns the filename that should be used for sample output.
|
||||
*
|
||||
* @param string $filename
|
||||
* @param string $extension
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFilename($filename, $extension = 'xlsx')
|
||||
|
@ -125,8 +134,10 @@ class Sample
|
|||
}
|
||||
|
||||
/**
|
||||
* Return a random temporary file name
|
||||
* Return a random temporary file name.
|
||||
*
|
||||
* @param string $extension
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTemporaryFilename($extension = 'xlsx')
|
||||
|
@ -143,7 +154,7 @@ class Sample
|
|||
}
|
||||
|
||||
/**
|
||||
* Log ending notes
|
||||
* Log ending notes.
|
||||
*/
|
||||
public function logEndingNotes()
|
||||
{
|
||||
|
@ -152,7 +163,8 @@ class Sample
|
|||
}
|
||||
|
||||
/**
|
||||
* Log a line about the write operation
|
||||
* Log a line about the write operation.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Writer\IWriter $writer
|
||||
* @param string $path
|
||||
* @param float $callStartTime
|
||||
|
@ -169,7 +181,8 @@ class Sample
|
|||
}
|
||||
|
||||
/**
|
||||
* Log a line about the read operation
|
||||
* Log a line about the read operation.
|
||||
*
|
||||
* @param string $format
|
||||
* @param string $path
|
||||
* @param float $callStartTime
|
||||
|
|
|
@ -18,13 +18,14 @@ namespace PhpOffice\PhpSpreadsheet;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
interface IComparable
|
||||
{
|
||||
/**
|
||||
* Get hash code
|
||||
* Get hash code.
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace PhpOffice\PhpSpreadsheet;
|
|||
use PhpOffice\PhpSpreadsheet\Shared\File;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -22,13 +22,14 @@ use PhpOffice\PhpSpreadsheet\Shared\File;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class IOFactory
|
||||
{
|
||||
/**
|
||||
* Search locations
|
||||
* Search locations.
|
||||
*
|
||||
* @var array
|
||||
* @static
|
||||
|
@ -39,7 +40,7 @@ class IOFactory
|
|||
];
|
||||
|
||||
/**
|
||||
* Autoresolve classes
|
||||
* Autoresolve classes.
|
||||
*
|
||||
* @var array
|
||||
* @static
|
||||
|
@ -56,16 +57,17 @@ class IOFactory
|
|||
];
|
||||
|
||||
/**
|
||||
* Private constructor for IOFactory
|
||||
* Private constructor for IOFactory.
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Get search locations
|
||||
* Get search locations.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getSearchLocations()
|
||||
|
@ -74,10 +76,12 @@ class IOFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* Set search locations
|
||||
* Set search locations.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @param array $value
|
||||
*
|
||||
* @throws Reader\Exception
|
||||
*/
|
||||
public static function setSearchLocations($value)
|
||||
|
@ -90,9 +94,10 @@ class IOFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* Add search location
|
||||
* Add search location.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @param string $type Example: IWriter
|
||||
* @param string $location Example: PhpSpreadsheet/Writer/{0}.php
|
||||
* @param string $classname Example: Writer\{0}
|
||||
|
@ -103,12 +108,15 @@ class IOFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* Create Writer\IWriter
|
||||
* Create Writer\IWriter.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @param Spreadsheet $spreadsheet
|
||||
* @param string $writerType Example: Xlsx
|
||||
*
|
||||
* @throws Writer\Exception
|
||||
*
|
||||
* @return Writer\IWriter
|
||||
*/
|
||||
public static function createWriter(Spreadsheet $spreadsheet, $writerType = '')
|
||||
|
@ -133,11 +141,14 @@ class IOFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* Create Reader\IReader
|
||||
* Create Reader\IReader.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @param string $readerType Example: Xlsx
|
||||
*
|
||||
* @throws Reader\Exception
|
||||
*
|
||||
* @return Reader\IReader
|
||||
*/
|
||||
public static function createReader($readerType = '')
|
||||
|
@ -162,11 +173,14 @@ class IOFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads Spreadsheet from file using automatic Reader\IReader resolution
|
||||
* Loads Spreadsheet from file using automatic Reader\IReader resolution.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @param string $pFilename The name of the spreadsheet file
|
||||
*
|
||||
* @throws Reader\Exception
|
||||
*
|
||||
* @return Spreadsheet
|
||||
*/
|
||||
public static function load($pFilename)
|
||||
|
@ -177,11 +191,14 @@ class IOFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* Identify file type using automatic Reader\IReader resolution
|
||||
* Identify file type using automatic Reader\IReader resolution.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @param string $pFilename The name of the spreadsheet file to identify
|
||||
*
|
||||
* @throws Reader\Exception
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function identify($pFilename)
|
||||
|
@ -195,11 +212,14 @@ class IOFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* Create Reader\IReader for file using automatic Reader\IReader resolution
|
||||
* Create Reader\IReader for file using automatic Reader\IReader resolution.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @param string $pFilename The name of the spreadsheet file
|
||||
*
|
||||
* @throws Reader\Exception
|
||||
*
|
||||
* @return Reader\IReader
|
||||
*/
|
||||
public static function createReaderForFile($pFilename)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,54 +20,56 @@ namespace PhpOffice\PhpSpreadsheet;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class NamedRange
|
||||
{
|
||||
/**
|
||||
* Range name
|
||||
* Range name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* Worksheet on which the named range can be resolved
|
||||
* Worksheet on which the named range can be resolved.
|
||||
*
|
||||
* @var Worksheet
|
||||
*/
|
||||
private $worksheet;
|
||||
|
||||
/**
|
||||
* Range of the referenced cells
|
||||
* Range of the referenced cells.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $range;
|
||||
|
||||
/**
|
||||
* Is the named range local? (i.e. can only be used on $this->worksheet)
|
||||
* Is the named range local? (i.e. can only be used on $this->worksheet).
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $localOnly;
|
||||
|
||||
/**
|
||||
* Scope
|
||||
* Scope.
|
||||
*
|
||||
* @var Worksheet
|
||||
*/
|
||||
private $scope;
|
||||
|
||||
/**
|
||||
* Create a new NamedRange
|
||||
* Create a new NamedRange.
|
||||
*
|
||||
* @param string $pName
|
||||
* @param Worksheet $pWorksheet
|
||||
* @param string $pRange
|
||||
* @param bool $pLocalOnly
|
||||
* @param Worksheet|null $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct($pName, Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
|
||||
|
@ -86,7 +88,7 @@ class NamedRange
|
|||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
* Get name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -96,9 +98,10 @@ class NamedRange
|
|||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
* Set name.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return NamedRange
|
||||
*/
|
||||
public function setName($value = null)
|
||||
|
@ -126,7 +129,7 @@ class NamedRange
|
|||
}
|
||||
|
||||
/**
|
||||
* Get worksheet
|
||||
* Get worksheet.
|
||||
*
|
||||
* @return Worksheet
|
||||
*/
|
||||
|
@ -136,9 +139,10 @@ class NamedRange
|
|||
}
|
||||
|
||||
/**
|
||||
* Set worksheet
|
||||
* Set worksheet.
|
||||
*
|
||||
* @param Worksheet $value
|
||||
*
|
||||
* @return NamedRange
|
||||
*/
|
||||
public function setWorksheet(Worksheet $value = null)
|
||||
|
@ -151,7 +155,7 @@ class NamedRange
|
|||
}
|
||||
|
||||
/**
|
||||
* Get range
|
||||
* Get range.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -161,9 +165,10 @@ class NamedRange
|
|||
}
|
||||
|
||||
/**
|
||||
* Set range
|
||||
* Set range.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return NamedRange
|
||||
*/
|
||||
public function setRange($value = null)
|
||||
|
@ -176,7 +181,7 @@ class NamedRange
|
|||
}
|
||||
|
||||
/**
|
||||
* Get localOnly
|
||||
* Get localOnly.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -186,9 +191,10 @@ class NamedRange
|
|||
}
|
||||
|
||||
/**
|
||||
* Set localOnly
|
||||
* Set localOnly.
|
||||
*
|
||||
* @param bool $value
|
||||
*
|
||||
* @return NamedRange
|
||||
*/
|
||||
public function setLocalOnly($value = false)
|
||||
|
@ -200,7 +206,7 @@ class NamedRange
|
|||
}
|
||||
|
||||
/**
|
||||
* Get scope
|
||||
* Get scope.
|
||||
*
|
||||
* @return Worksheet|null
|
||||
*/
|
||||
|
@ -210,9 +216,10 @@ class NamedRange
|
|||
}
|
||||
|
||||
/**
|
||||
* Set scope
|
||||
* Set scope.
|
||||
*
|
||||
* @param Worksheet|null $value
|
||||
*
|
||||
* @return NamedRange
|
||||
*/
|
||||
public function setScope(Worksheet $value = null)
|
||||
|
@ -224,10 +231,11 @@ class NamedRange
|
|||
}
|
||||
|
||||
/**
|
||||
* Resolve a named range to a regular cell range
|
||||
* Resolve a named range to a regular cell range.
|
||||
*
|
||||
* @param string $pNamedRange Named range
|
||||
* @param Worksheet|null $pSheet Scope. Use null for global scope
|
||||
*
|
||||
* @return NamedRange
|
||||
*/
|
||||
public static function resolveRange($pNamedRange, Worksheet $pSheet = null)
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader;
|
|||
use PhpOffice\PhpSpreadsheet\Shared\File;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -22,6 +22,7 @@ use PhpOffice\PhpSpreadsheet\Shared\File;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -30,7 +31,7 @@ abstract class BaseReader implements IReader
|
|||
/**
|
||||
* Read data only?
|
||||
* Identifies whether the Reader should only read data values for cells, and ignore any formatting information;
|
||||
* or whether it should read both data and formatting
|
||||
* or whether it should read both data and formatting.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
|
@ -39,7 +40,7 @@ abstract class BaseReader implements IReader
|
|||
/**
|
||||
* Read empty cells?
|
||||
* Identifies whether the Reader should read data values for cells all cells, or should ignore cells containing
|
||||
* null value or empty string
|
||||
* null value or empty string.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
|
@ -47,7 +48,7 @@ abstract class BaseReader implements IReader
|
|||
|
||||
/**
|
||||
* Read charts that are defined in the workbook?
|
||||
* Identifies whether the Reader should read the definitions for any charts that exist in the workbook;
|
||||
* Identifies whether the Reader should read the definitions for any charts that exist in the workbook;.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
|
@ -62,7 +63,7 @@ abstract class BaseReader implements IReader
|
|||
protected $loadSheetsOnly;
|
||||
|
||||
/**
|
||||
* IReadFilter instance
|
||||
* IReadFilter instance.
|
||||
*
|
||||
* @var IReadFilter
|
||||
*/
|
||||
|
@ -93,7 +94,7 @@ abstract class BaseReader implements IReader
|
|||
*/
|
||||
public function setReadDataOnly($pValue = false)
|
||||
{
|
||||
$this->readDataOnly = (boolean) $pValue;
|
||||
$this->readDataOnly = (bool) $pValue;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -121,7 +122,7 @@ abstract class BaseReader implements IReader
|
|||
*/
|
||||
public function setReadEmptyCells($pValue = true)
|
||||
{
|
||||
$this->readEmptyCells = (boolean) $pValue;
|
||||
$this->readEmptyCells = (bool) $pValue;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -151,7 +152,7 @@ abstract class BaseReader implements IReader
|
|||
*/
|
||||
public function setIncludeCharts($pValue = false)
|
||||
{
|
||||
$this->includeCharts = (boolean) $pValue;
|
||||
$this->includeCharts = (bool) $pValue;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -169,7 +170,7 @@ abstract class BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Set which sheets to load
|
||||
* Set which sheets to load.
|
||||
*
|
||||
* @param mixed $value
|
||||
* This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name.
|
||||
|
@ -202,7 +203,7 @@ abstract class BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Read filter
|
||||
* Read filter.
|
||||
*
|
||||
* @return IReadFilter
|
||||
*/
|
||||
|
@ -212,9 +213,10 @@ abstract class BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Set read filter
|
||||
* Set read filter.
|
||||
*
|
||||
* @param IReadFilter $pValue
|
||||
*
|
||||
* @return IReader
|
||||
*/
|
||||
public function setReadFilter(IReadFilter $pValue)
|
||||
|
@ -225,10 +227,12 @@ abstract class BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Open file for reading
|
||||
* Open file for reading.
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return resource
|
||||
*/
|
||||
protected function openFile($pFilename)
|
||||
|
@ -243,9 +247,10 @@ abstract class BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks
|
||||
* Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks.
|
||||
*
|
||||
* @param string $xml
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function securityScan($xml)
|
||||
|
@ -259,9 +264,10 @@ abstract class BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks
|
||||
* Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks.
|
||||
*
|
||||
* @param string $filestream
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function securityScanFile($filestream)
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader;
|
|||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -22,55 +22,56 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class CSV extends BaseReader implements IReader
|
||||
{
|
||||
/**
|
||||
* Input encoding
|
||||
* Input encoding.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $inputEncoding = 'UTF-8';
|
||||
|
||||
/**
|
||||
* Delimiter
|
||||
* Delimiter.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $delimiter = ',';
|
||||
|
||||
/**
|
||||
* Enclosure
|
||||
* Enclosure.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $enclosure = '"';
|
||||
|
||||
/**
|
||||
* Sheet index to read
|
||||
* Sheet index to read.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $sheetIndex = 0;
|
||||
|
||||
/**
|
||||
* Load rows contiguously
|
||||
* Load rows contiguously.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $contiguous = false;
|
||||
|
||||
/**
|
||||
* Row counter for loading rows contiguously
|
||||
* Row counter for loading rows contiguously.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $contiguousRow = -1;
|
||||
|
||||
/**
|
||||
* Create a new CSV Reader instance
|
||||
* Create a new CSV Reader instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -78,7 +79,7 @@ class CSV extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Set input encoding
|
||||
* Set input encoding.
|
||||
*
|
||||
* @param string $pValue Input encoding
|
||||
*/
|
||||
|
@ -90,7 +91,7 @@ class CSV extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Get input encoding
|
||||
* Get input encoding.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -100,7 +101,7 @@ class CSV extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Move filepointer past any BOM marker
|
||||
* Move filepointer past any BOM marker.
|
||||
*/
|
||||
protected function skipBOM()
|
||||
{
|
||||
|
@ -133,7 +134,7 @@ class CSV extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Identify any separator that is explicitly set in the file
|
||||
* Identify any separator that is explicitly set in the file.
|
||||
*/
|
||||
protected function checkSeparator()
|
||||
{
|
||||
|
@ -152,9 +153,10 @@ class CSV extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns).
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function listWorksheetInfo($pFilename)
|
||||
|
@ -195,10 +197,12 @@ class CSV extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads Spreadsheet from file
|
||||
* Loads Spreadsheet from file.
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Spreadsheet
|
||||
*/
|
||||
public function load($pFilename)
|
||||
|
@ -211,11 +215,13 @@ class CSV extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads PhpSpreadsheet from file into PhpSpreadsheet instance
|
||||
* Loads PhpSpreadsheet from file into PhpSpreadsheet instance.
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @param Spreadsheet $spreadsheet
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return Spreadsheet
|
||||
*/
|
||||
public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet)
|
||||
|
@ -286,7 +292,7 @@ class CSV extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Get delimiter
|
||||
* Get delimiter.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -296,9 +302,10 @@ class CSV extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Set delimiter
|
||||
* Set delimiter.
|
||||
*
|
||||
* @param string $pValue Delimiter, defaults to ,
|
||||
*
|
||||
* @return CSV
|
||||
*/
|
||||
public function setDelimiter($pValue = ',')
|
||||
|
@ -309,7 +316,7 @@ class CSV extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Get enclosure
|
||||
* Get enclosure.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -319,9 +326,10 @@ class CSV extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Set enclosure
|
||||
* Set enclosure.
|
||||
*
|
||||
* @param string $pValue Enclosure, defaults to "
|
||||
*
|
||||
* @return CSV
|
||||
*/
|
||||
public function setEnclosure($pValue = '"')
|
||||
|
@ -335,7 +343,7 @@ class CSV extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Get sheet index
|
||||
* Get sheet index.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
@ -345,9 +353,10 @@ class CSV extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Set sheet index
|
||||
* Set sheet index.
|
||||
*
|
||||
* @param int $pValue Sheet index
|
||||
*
|
||||
* @return CSV
|
||||
*/
|
||||
public function setSheetIndex($pValue = 0)
|
||||
|
@ -358,7 +367,7 @@ class CSV extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Contiguous
|
||||
* Set Contiguous.
|
||||
*
|
||||
* @param bool $contiguous
|
||||
*/
|
||||
|
@ -373,7 +382,7 @@ class CSV extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Contiguous
|
||||
* Get Contiguous.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -386,7 +395,9 @@ class CSV extends BaseReader implements IReader
|
|||
* Can the current IReader read the file?
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canRead($pFilename)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Reader;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -31,6 +32,7 @@ class DefaultReadFilter implements IReadFilter
|
|||
* @param $column Column address (as a string value like "A", or "IV")
|
||||
* @param $row Row number
|
||||
* @param $worksheetName Optional worksheet name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function readCell($column, $row, $worksheetName = '')
|
||||
|
|
|
@ -6,7 +6,7 @@ use PhpOffice\PhpSpreadsheet\Shared\File;
|
|||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -23,27 +23,28 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Excel2003XML extends BaseReader implements IReader
|
||||
{
|
||||
/**
|
||||
* Formats
|
||||
* Formats.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $styles = [];
|
||||
|
||||
/**
|
||||
* Character set used in the file
|
||||
* Character set used in the file.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $charSet = 'UTF-8';
|
||||
|
||||
/**
|
||||
* Create a new Excel2003XML Reader instance
|
||||
* Create a new Excel2003XML Reader instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -54,12 +55,13 @@ class Excel2003XML extends BaseReader implements IReader
|
|||
* Can the current IReader read the file?
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canRead($pFilename)
|
||||
{
|
||||
|
||||
// Office xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||
// Excel xmlns:x="urn:schemas-microsoft-com:office:excel"
|
||||
// XML Spreadsheet xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
|
||||
|
@ -102,9 +104,10 @@ class Excel2003XML extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object
|
||||
* Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object.
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function listWorksheetNames($pFilename)
|
||||
|
@ -133,9 +136,10 @@ class Excel2003XML extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns).
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function listWorksheetInfo($pFilename)
|
||||
|
@ -204,10 +208,12 @@ class Excel2003XML extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads Spreadsheet from file
|
||||
* Loads Spreadsheet from file.
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Spreadsheet
|
||||
*/
|
||||
public function load($pFilename)
|
||||
|
@ -235,8 +241,11 @@ class Excel2003XML extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* pixel units to excel width units(units of 1/256th of a character width)
|
||||
* pixel units to excel width units(units of 1/256th of a character width).
|
||||
*
|
||||
* @param pxs
|
||||
* @param mixed $pxs
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected static function pixel2WidthUnits($pxs)
|
||||
|
@ -250,8 +259,11 @@ class Excel2003XML extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* excel width units(units of 1/256th of a character width) to pixel units
|
||||
* excel width units(units of 1/256th of a character width) to pixel units.
|
||||
*
|
||||
* @param widthUnits
|
||||
* @param mixed $widthUnits
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected static function widthUnits2Pixel($widthUnits)
|
||||
|
@ -269,11 +281,13 @@ class Excel2003XML extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads from file into Spreadsheet instance
|
||||
* Loads from file into Spreadsheet instance.
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Spreadsheet
|
||||
*/
|
||||
public function loadIntoExisting($pFilename, \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet)
|
||||
|
@ -376,11 +390,11 @@ class Excel2003XML extends BaseReader implements IReader
|
|||
break;
|
||||
case 'integer':
|
||||
$propertyType = \PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_INTEGER;
|
||||
$propertyValue = intval($propertyValue);
|
||||
$propertyValue = (int) $propertyValue;
|
||||
break;
|
||||
case 'float':
|
||||
$propertyType = \PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_FLOAT;
|
||||
$propertyValue = floatval($propertyValue);
|
||||
$propertyValue = (float) $propertyValue;
|
||||
break;
|
||||
case 'dateTime.tz':
|
||||
$propertyType = \PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_DATE;
|
||||
|
@ -549,7 +563,7 @@ class Excel2003XML extends BaseReader implements IReader
|
|||
$rowHasData = false;
|
||||
$row_ss = $rowData->attributes($namespaces['ss']);
|
||||
if (isset($row_ss['Index'])) {
|
||||
$rowID = (integer) $row_ss['Index'];
|
||||
$rowID = (int) $row_ss['Index'];
|
||||
}
|
||||
|
||||
$columnID = 'A';
|
||||
|
@ -615,7 +629,7 @@ class Excel2003XML extends BaseReader implements IReader
|
|||
$type = \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC;
|
||||
$cellValue = (float) $cellValue;
|
||||
if (floor($cellValue) == $cellValue) {
|
||||
$cellValue = (integer) $cellValue;
|
||||
$cellValue = (int) $cellValue;
|
||||
}
|
||||
break;
|
||||
case 'Boolean':
|
||||
|
@ -666,7 +680,7 @@ class Excel2003XML extends BaseReader implements IReader
|
|||
$rowReference = $rowID;
|
||||
}
|
||||
// Bracketed R references are relative to the current row
|
||||
if ($rowReference{0} == '[') {
|
||||
if ($rowReference[0] == '[') {
|
||||
$rowReference = $rowID + trim($rowReference, '[]');
|
||||
}
|
||||
$columnReference = $cellReference[4][0];
|
||||
|
@ -675,7 +689,7 @@ class Excel2003XML extends BaseReader implements IReader
|
|||
$columnReference = $columnNumber;
|
||||
}
|
||||
// Bracketed C references are relative to the current column
|
||||
if ($columnReference{0} == '[') {
|
||||
if ($columnReference[0] == '[') {
|
||||
$columnReference = $columnNumber + trim($columnReference, '[]');
|
||||
}
|
||||
$A1CellReference = \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($columnReference - 1) . $rowReference;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Reader;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet\Reader;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Exception extends \PhpOffice\PhpSpreadsheet\Exception
|
||||
{
|
||||
/**
|
||||
* Error handler callback
|
||||
* Error handler callback.
|
||||
*
|
||||
* @param mixed $code
|
||||
* @param mixed $string
|
||||
|
|
|
@ -7,7 +7,7 @@ use PhpOffice\PhpSpreadsheet\Shared\File;
|
|||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -24,20 +24,21 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Gnumeric extends BaseReader implements IReader
|
||||
{
|
||||
/**
|
||||
* Formats
|
||||
* Formats.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $styles = [];
|
||||
|
||||
/**
|
||||
* Shared Expressions
|
||||
* Shared Expressions.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
@ -46,7 +47,7 @@ class Gnumeric extends BaseReader implements IReader
|
|||
private $referenceHelper = null;
|
||||
|
||||
/**
|
||||
* Create a new Gnumeric
|
||||
* Create a new Gnumeric.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -58,7 +59,9 @@ class Gnumeric extends BaseReader implements IReader
|
|||
* Can the current IReader read the file?
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canRead($pFilename)
|
||||
|
@ -83,9 +86,10 @@ class Gnumeric extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object
|
||||
* Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object.
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function listWorksheetNames($pFilename)
|
||||
|
@ -111,9 +115,10 @@ class Gnumeric extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns).
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function listWorksheetInfo($pFilename)
|
||||
|
@ -175,10 +180,12 @@ class Gnumeric extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads Spreadsheet from file
|
||||
* Loads Spreadsheet from file.
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return Spreadsheet
|
||||
*/
|
||||
public function load($pFilename)
|
||||
|
@ -191,11 +198,13 @@ class Gnumeric extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads from file into Spreadsheet instance
|
||||
* Loads from file into Spreadsheet instance.
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @param Spreadsheet $spreadsheet
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return Spreadsheet
|
||||
*/
|
||||
public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet)
|
||||
|
@ -339,7 +348,7 @@ class Gnumeric extends BaseReader implements IReader
|
|||
$marginSize = 72 / 100; // Default
|
||||
switch ($marginAttributes['PrefUnit']) {
|
||||
case 'mm':
|
||||
$marginSize = intval($marginAttributes['Points']) / 100;
|
||||
$marginSize = (int) ($marginAttributes['Points']) / 100;
|
||||
break;
|
||||
}
|
||||
switch ($key) {
|
||||
|
@ -419,7 +428,7 @@ class Gnumeric extends BaseReader implements IReader
|
|||
$cell = ($cell == 'TRUE') ? true : false;
|
||||
break;
|
||||
case '30': // Integer
|
||||
$cell = intval($cell);
|
||||
$cell = (int) $cell;
|
||||
// Excel 2007+ doesn't differentiate between integer and float, so set the value and dropthru to the next (numeric) case
|
||||
case '40': // Float
|
||||
$type = \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC;
|
||||
|
@ -507,7 +516,7 @@ class Gnumeric extends BaseReader implements IReader
|
|||
|
||||
$styleArray['alignment']['wrap'] = ($styleAttributes['WrapText'] == '1') ? true : false;
|
||||
$styleArray['alignment']['shrinkToFit'] = ($styleAttributes['ShrinkToFit'] == '1') ? true : false;
|
||||
$styleArray['alignment']['indent'] = (intval($styleAttributes['Indent']) > 0) ? $styleAttributes['indent'] : 0;
|
||||
$styleArray['alignment']['indent'] = ((int) ($styleAttributes['Indent']) > 0) ? $styleAttributes['indent'] : 0;
|
||||
|
||||
$RGB = self::parseGnumericColour($styleAttributes['Fore']);
|
||||
$styleArray['font']['color']['rgb'] = $RGB;
|
||||
|
@ -583,7 +592,7 @@ class Gnumeric extends BaseReader implements IReader
|
|||
|
||||
$fontAttributes = $styleRegion->Style->Font->attributes();
|
||||
$styleArray['font']['name'] = (string) $styleRegion->Style->Font;
|
||||
$styleArray['font']['size'] = intval($fontAttributes['Unit']);
|
||||
$styleArray['font']['size'] = (int) ($fontAttributes['Unit']);
|
||||
$styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? true : false;
|
||||
$styleArray['font']['italic'] = ($fontAttributes['Italic'] == '1') ? true : false;
|
||||
$styleArray['font']['strike'] = ($fontAttributes['StrikeThrough'] == '1') ? true : false;
|
||||
|
|
|
@ -9,7 +9,7 @@ use DOMText;
|
|||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -26,6 +26,7 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -33,26 +34,26 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|||
class HTML extends BaseReader implements IReader
|
||||
{
|
||||
/**
|
||||
* Sample size to read to determine if it's HTML or not
|
||||
* Sample size to read to determine if it's HTML or not.
|
||||
*/
|
||||
const TEST_SAMPLE_SIZE = 2048;
|
||||
|
||||
/**
|
||||
* Input encoding
|
||||
* Input encoding.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $inputEncoding = 'ANSI';
|
||||
|
||||
/**
|
||||
* Sheet index to read
|
||||
* Sheet index to read.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $sheetIndex = 0;
|
||||
|
||||
/**
|
||||
* Formats
|
||||
* Formats.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
@ -116,7 +117,7 @@ class HTML extends BaseReader implements IReader
|
|||
protected $rowspan = [];
|
||||
|
||||
/**
|
||||
* Create a new HTML Reader instance
|
||||
* Create a new HTML Reader instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -124,10 +125,12 @@ class HTML extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Validate that the current file is an HTML file
|
||||
* Validate that the current file is an HTML file.
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canRead($pFilename)
|
||||
|
@ -185,10 +188,12 @@ class HTML extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads Spreadsheet from file
|
||||
* Loads Spreadsheet from file.
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return Spreadsheet
|
||||
*/
|
||||
public function load($pFilename)
|
||||
|
@ -201,7 +206,7 @@ class HTML extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Set input encoding
|
||||
* Set input encoding.
|
||||
*
|
||||
* @param string $pValue Input encoding
|
||||
*/
|
||||
|
@ -213,7 +218,7 @@ class HTML extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Get input encoding
|
||||
* Get input encoding.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -284,10 +289,9 @@ class HTML extends BaseReader implements IReader
|
|||
if (is_string($cellContent)) {
|
||||
// simply append the text if the cell content is a plain text string
|
||||
$cellContent .= $domText;
|
||||
} else {
|
||||
}
|
||||
// but if we have a rich text run instead, we need to append it correctly
|
||||
// TODO
|
||||
}
|
||||
} elseif ($child instanceof DOMElement) {
|
||||
$attributeArray = [];
|
||||
foreach ($child->attributes as $attribute) {
|
||||
|
@ -493,11 +497,13 @@ class HTML extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads PhpSpreadsheet from file into PhpSpreadsheet instance
|
||||
* Loads PhpSpreadsheet from file into PhpSpreadsheet instance.
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @param Spreadsheet $spreadsheet
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return Spreadsheet
|
||||
*/
|
||||
public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet)
|
||||
|
@ -534,7 +540,7 @@ class HTML extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Get sheet index
|
||||
* Get sheet index.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
@ -544,9 +550,10 @@ class HTML extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Set sheet index
|
||||
* Set sheet index.
|
||||
*
|
||||
* @param int $pValue Sheet index
|
||||
*
|
||||
* @return HTML
|
||||
*/
|
||||
public function setSheetIndex($pValue = 0)
|
||||
|
@ -557,9 +564,10 @@ class HTML extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks
|
||||
* Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks.
|
||||
*
|
||||
* @param string $xml
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function securityScan($xml)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Reader;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -31,6 +32,7 @@ interface IReadFilter
|
|||
* @param $column Column address (as a string value like "A", or "IV")
|
||||
* @param $row Row number
|
||||
* @param $worksheetName Optional worksheet name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function readCell($column, $row, $worksheetName = '');
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Reader;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -29,15 +30,18 @@ interface IReader
|
|||
* Can the current IReader read the file?
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canRead($pFilename);
|
||||
|
||||
/**
|
||||
* Loads PhpSpreadsheet from file
|
||||
* Loads PhpSpreadsheet from file.
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return PhpSpreadsheet
|
||||
*/
|
||||
public function load($pFilename);
|
||||
|
|
|
@ -7,7 +7,7 @@ use DateTimeZone;
|
|||
use PhpOffice\PhpSpreadsheet\Shared\File;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -24,20 +24,21 @@ use PhpOffice\PhpSpreadsheet\Shared\File;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Ods extends BaseReader implements IReader
|
||||
{
|
||||
/**
|
||||
* Formats
|
||||
* Formats.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $styles = [];
|
||||
|
||||
/**
|
||||
* Create a new Ods Reader instance
|
||||
* Create a new Ods Reader instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -48,7 +49,9 @@ class Ods extends BaseReader implements IReader
|
|||
* Can the current IReader read the file?
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canRead($pFilename)
|
||||
|
@ -93,9 +96,10 @@ class Ods extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Reads names of the worksheets from a file, without parsing the whole file to a PhpSpreadsheet object
|
||||
* Reads names of the worksheets from a file, without parsing the whole file to a PhpSpreadsheet object.
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function listWorksheetNames($pFilename)
|
||||
|
@ -146,9 +150,10 @@ class Ods extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns).
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function listWorksheetInfo($pFilename)
|
||||
|
@ -237,10 +242,12 @@ class Ods extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads PhpSpreadsheet from file
|
||||
* Loads PhpSpreadsheet from file.
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Spreadsheet
|
||||
*/
|
||||
public function load($pFilename)
|
||||
|
@ -267,11 +274,13 @@ class Ods extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads PhpSpreadsheet from file into PhpSpreadsheet instance
|
||||
* Loads PhpSpreadsheet from file into PhpSpreadsheet instance.
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Spreadsheet
|
||||
*/
|
||||
public function loadIntoExisting($pFilename, \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet)
|
||||
|
@ -496,7 +505,7 @@ class Ods extends BaseReader implements IReader
|
|||
$type = \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC;
|
||||
$dataValue = (float) $cellDataOfficeAttributes['value'];
|
||||
if (floor($dataValue) == $dataValue) {
|
||||
$dataValue = (integer) $dataValue;
|
||||
$dataValue = (int) $dataValue;
|
||||
}
|
||||
$formatting = \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_PERCENTAGE_00;
|
||||
break;
|
||||
|
@ -504,7 +513,7 @@ class Ods extends BaseReader implements IReader
|
|||
$type = \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC;
|
||||
$dataValue = (float) $cellDataOfficeAttributes['value'];
|
||||
if (floor($dataValue) == $dataValue) {
|
||||
$dataValue = (integer) $dataValue;
|
||||
$dataValue = (int) $dataValue;
|
||||
}
|
||||
$formatting = \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
|
||||
break;
|
||||
|
@ -512,8 +521,8 @@ class Ods extends BaseReader implements IReader
|
|||
$type = \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC;
|
||||
$dataValue = (float) $cellDataOfficeAttributes['value'];
|
||||
if (floor($dataValue) == $dataValue) {
|
||||
if ($dataValue == (integer) $dataValue) {
|
||||
$dataValue = (integer) $dataValue;
|
||||
if ($dataValue == (int) $dataValue) {
|
||||
$dataValue = (int) $dataValue;
|
||||
} else {
|
||||
$dataValue = (float) $dataValue;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Reader;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,41 +20,42 @@ namespace PhpOffice\PhpSpreadsheet\Reader;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class SYLK extends BaseReader implements IReader
|
||||
{
|
||||
/**
|
||||
* Input encoding
|
||||
* Input encoding.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $inputEncoding = 'ANSI';
|
||||
|
||||
/**
|
||||
* Sheet index to read
|
||||
* Sheet index to read.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $sheetIndex = 0;
|
||||
|
||||
/**
|
||||
* Formats
|
||||
* Formats.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $formats = [];
|
||||
|
||||
/**
|
||||
* Format Count
|
||||
* Format Count.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $format = 0;
|
||||
|
||||
/**
|
||||
* Create a new SYLK Reader instance
|
||||
* Create a new SYLK Reader instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -62,10 +63,12 @@ class SYLK extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Validate that the current file is a SYLK file
|
||||
* Validate that the current file is a SYLK file.
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canRead($pFilename)
|
||||
|
@ -94,7 +97,7 @@ class SYLK extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Set input encoding
|
||||
* Set input encoding.
|
||||
*
|
||||
* @param string $pValue Input encoding
|
||||
*/
|
||||
|
@ -106,7 +109,7 @@ class SYLK extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Get input encoding
|
||||
* Get input encoding.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -116,9 +119,10 @@ class SYLK extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns).
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function listWorksheetInfo($pFilename)
|
||||
|
@ -157,7 +161,7 @@ class SYLK extends BaseReader implements IReader
|
|||
if ($dataType == 'C') {
|
||||
// Read cell value data
|
||||
foreach ($rowData as $rowDatum) {
|
||||
switch ($rowDatum{0}) {
|
||||
switch ($rowDatum[0]) {
|
||||
case 'C':
|
||||
case 'X':
|
||||
$columnIndex = substr($rowDatum, 1) - 1;
|
||||
|
@ -184,10 +188,12 @@ class SYLK extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads PhpSpreadsheet from file
|
||||
* Loads PhpSpreadsheet from file.
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Spreadsheet
|
||||
*/
|
||||
public function load($pFilename)
|
||||
|
@ -200,11 +206,13 @@ class SYLK extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads PhpSpreadsheet from file into PhpSpreadsheet instance
|
||||
* Loads PhpSpreadsheet from file into PhpSpreadsheet instance.
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Spreadsheet
|
||||
*/
|
||||
public function loadIntoExisting($pFilename, \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet)
|
||||
|
@ -244,7 +252,7 @@ class SYLK extends BaseReader implements IReader
|
|||
if ($dataType == 'P') {
|
||||
$formatArray = [];
|
||||
foreach ($rowData as $rowDatum) {
|
||||
switch ($rowDatum{0}) {
|
||||
switch ($rowDatum[0]) {
|
||||
case 'P':
|
||||
$formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats, substr($rowDatum, 1));
|
||||
break;
|
||||
|
@ -258,7 +266,7 @@ class SYLK extends BaseReader implements IReader
|
|||
case 'S':
|
||||
$styleSettings = substr($rowDatum, 1);
|
||||
for ($i = 0; $i < strlen($styleSettings); ++$i) {
|
||||
switch ($styleSettings{$i}) {
|
||||
switch ($styleSettings[$i]) {
|
||||
case 'I':
|
||||
$formatArray['font']['italic'] = true;
|
||||
break;
|
||||
|
@ -288,7 +296,7 @@ class SYLK extends BaseReader implements IReader
|
|||
$hasCalculatedValue = false;
|
||||
$cellData = $cellDataFormula = '';
|
||||
foreach ($rowData as $rowDatum) {
|
||||
switch ($rowDatum{0}) {
|
||||
switch ($rowDatum[0]) {
|
||||
case 'C':
|
||||
case 'X':
|
||||
$column = substr($rowDatum, 1);
|
||||
|
@ -322,7 +330,7 @@ class SYLK extends BaseReader implements IReader
|
|||
$rowReference = $row;
|
||||
}
|
||||
// Bracketed R references are relative to the current row
|
||||
if ($rowReference{0} == '[') {
|
||||
if ($rowReference[0] == '[') {
|
||||
$rowReference = $row + trim($rowReference, '[]');
|
||||
}
|
||||
$columnReference = $cellReference[4][0];
|
||||
|
@ -331,7 +339,7 @@ class SYLK extends BaseReader implements IReader
|
|||
$columnReference = $column;
|
||||
}
|
||||
// Bracketed C references are relative to the current column
|
||||
if ($columnReference{0} == '[') {
|
||||
if ($columnReference[0] == '[') {
|
||||
$columnReference = $column + trim($columnReference, '[]');
|
||||
}
|
||||
$A1CellReference = \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($columnReference - 1) . $rowReference;
|
||||
|
@ -361,7 +369,7 @@ class SYLK extends BaseReader implements IReader
|
|||
$formatStyle = $columnWidth = $styleSettings = '';
|
||||
$styleData = [];
|
||||
foreach ($rowData as $rowDatum) {
|
||||
switch ($rowDatum{0}) {
|
||||
switch ($rowDatum[0]) {
|
||||
case 'C':
|
||||
case 'X':
|
||||
$column = substr($rowDatum, 1);
|
||||
|
@ -379,7 +387,7 @@ class SYLK extends BaseReader implements IReader
|
|||
case 'S':
|
||||
$styleSettings = substr($rowDatum, 1);
|
||||
for ($i = 0; $i < strlen($styleSettings); ++$i) {
|
||||
switch ($styleSettings{$i}) {
|
||||
switch ($styleSettings[$i]) {
|
||||
case 'I':
|
||||
$styleData['font']['italic'] = true;
|
||||
break;
|
||||
|
@ -428,7 +436,7 @@ class SYLK extends BaseReader implements IReader
|
|||
}
|
||||
} else {
|
||||
foreach ($rowData as $rowDatum) {
|
||||
switch ($rowDatum{0}) {
|
||||
switch ($rowDatum[0]) {
|
||||
case 'C':
|
||||
case 'X':
|
||||
$column = substr($rowDatum, 1);
|
||||
|
@ -450,7 +458,7 @@ class SYLK extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Get sheet index
|
||||
* Get sheet index.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
@ -460,9 +468,10 @@ class SYLK extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Set sheet index
|
||||
* Set sheet index.
|
||||
*
|
||||
* @param int $pValue Sheet index
|
||||
*
|
||||
* @return SYLK
|
||||
*/
|
||||
public function setSheetIndex($pValue = 0)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -5,11 +5,12 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xls;
|
|||
class Color
|
||||
{
|
||||
/**
|
||||
* Read color
|
||||
* Read color.
|
||||
*
|
||||
* @param int $color Indexed color
|
||||
* @param array $palette Color palette
|
||||
* @param int $version
|
||||
*
|
||||
* @return array RGB color value, example: array('rgb' => 'FF0000')
|
||||
*/
|
||||
public static function map($color, $palette, $version)
|
||||
|
@ -20,16 +21,13 @@ class Color
|
|||
} elseif (isset($palette) && isset($palette[$color - 8])) {
|
||||
// palette color, color index 0x08 maps to pallete index 0
|
||||
return $palette[$color - 8];
|
||||
} else {
|
||||
}
|
||||
// default color table
|
||||
if ($version == \PhpOffice\PhpSpreadsheet\Reader\Xls::XLS_BIFF8) {
|
||||
return Color\BIFF8::lookup($color);
|
||||
} else {
|
||||
}
|
||||
// BIFF5
|
||||
return Color\BIFF5::lookup($color);
|
||||
}
|
||||
}
|
||||
|
||||
return $color;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,9 +64,10 @@ class BIFF5
|
|||
];
|
||||
|
||||
/**
|
||||
* Map color array from BIFF5 built-in color index
|
||||
* Map color array from BIFF5 built-in color index.
|
||||
*
|
||||
* @param int $color
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function lookup($color)
|
||||
|
|
|
@ -64,9 +64,10 @@ class BIFF8
|
|||
];
|
||||
|
||||
/**
|
||||
* Map color array from BIFF8 built-in color index
|
||||
* Map color array from BIFF8 built-in color index.
|
||||
*
|
||||
* @param int $color
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function lookup($color)
|
||||
|
|
|
@ -18,9 +18,10 @@ class BuiltIn
|
|||
];
|
||||
|
||||
/**
|
||||
* Map built-in color to RGB value
|
||||
* Map built-in color to RGB value.
|
||||
*
|
||||
* @param int $color Indexed color
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function lookup($color)
|
||||
|
|
|
@ -15,9 +15,10 @@ class ErrorCode
|
|||
];
|
||||
|
||||
/**
|
||||
* Map error code, e.g. '#N/A'
|
||||
* Map error code, e.g. '#N/A'.
|
||||
*
|
||||
* @param int $code
|
||||
*
|
||||
* @return string|bool
|
||||
*/
|
||||
public static function lookup($code)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Reader\Xls;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xls;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -45,21 +46,21 @@ class Escher
|
|||
const TERTIARYOPT = 0xF122;
|
||||
|
||||
/**
|
||||
* Escher stream data (binary)
|
||||
* Escher stream data (binary).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $data;
|
||||
|
||||
/**
|
||||
* Size in bytes of the Escher stream data
|
||||
* Size in bytes of the Escher stream data.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $dataSize;
|
||||
|
||||
/**
|
||||
* Current position of stream pointer in Escher stream data
|
||||
* Current position of stream pointer in Escher stream data.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
|
@ -73,7 +74,7 @@ class Escher
|
|||
private $object;
|
||||
|
||||
/**
|
||||
* Create a new Escher instance
|
||||
* Create a new Escher instance.
|
||||
*
|
||||
* @param mixed $object
|
||||
*/
|
||||
|
@ -166,7 +167,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read a generic record
|
||||
* Read a generic record.
|
||||
*/
|
||||
private function readDefault()
|
||||
{
|
||||
|
@ -187,7 +188,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read DggContainer record (Drawing Group Container)
|
||||
* Read DggContainer record (Drawing Group Container).
|
||||
*/
|
||||
private function readDggContainer()
|
||||
{
|
||||
|
@ -205,7 +206,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read Dgg record (Drawing Group)
|
||||
* Read Dgg record (Drawing Group).
|
||||
*/
|
||||
private function readDgg()
|
||||
{
|
||||
|
@ -217,7 +218,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read BstoreContainer record (Blip Store Container)
|
||||
* Read BstoreContainer record (Blip Store Container).
|
||||
*/
|
||||
private function readBstoreContainer()
|
||||
{
|
||||
|
@ -235,7 +236,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read BSE record
|
||||
* Read BSE record.
|
||||
*/
|
||||
private function readBSE()
|
||||
{
|
||||
|
@ -278,16 +279,16 @@ class Escher
|
|||
$foDelay = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($recordData, 28);
|
||||
|
||||
// offset: 32; size: 1; unused1
|
||||
$unused1 = ord($recordData{32});
|
||||
$unused1 = ord($recordData[32]);
|
||||
|
||||
// offset: 33; size: 1; size of nameData in bytes (including null terminator)
|
||||
$cbName = ord($recordData{33});
|
||||
$cbName = ord($recordData[33]);
|
||||
|
||||
// offset: 34; size: 1; unused2
|
||||
$unused2 = ord($recordData{34});
|
||||
$unused2 = ord($recordData[34]);
|
||||
|
||||
// offset: 35; size: 1; unused3
|
||||
$unused3 = ord($recordData{35});
|
||||
$unused3 = ord($recordData[35]);
|
||||
|
||||
// offset: 36; size: $cbName; nameData
|
||||
$nameData = substr($recordData, 36, $cbName);
|
||||
|
@ -301,7 +302,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read BlipJPEG record. Holds raw JPEG image data
|
||||
* Read BlipJPEG record. Holds raw JPEG image data.
|
||||
*/
|
||||
private function readBlipJPEG()
|
||||
{
|
||||
|
@ -329,7 +330,7 @@ class Escher
|
|||
}
|
||||
|
||||
// offset: var; size: 1; tag
|
||||
$tag = ord($recordData{$pos});
|
||||
$tag = ord($recordData[$pos]);
|
||||
$pos += 1;
|
||||
|
||||
// offset: var; size: var; the raw image data
|
||||
|
@ -342,7 +343,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read BlipPNG record. Holds raw PNG image data
|
||||
* Read BlipPNG record. Holds raw PNG image data.
|
||||
*/
|
||||
private function readBlipPNG()
|
||||
{
|
||||
|
@ -370,7 +371,7 @@ class Escher
|
|||
}
|
||||
|
||||
// offset: var; size: 1; tag
|
||||
$tag = ord($recordData{$pos});
|
||||
$tag = ord($recordData[$pos]);
|
||||
$pos += 1;
|
||||
|
||||
// offset: var; size: var; the raw image data
|
||||
|
@ -383,7 +384,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read OPT record. This record may occur within DggContainer record or SpContainer
|
||||
* Read OPT record. This record may occur within DggContainer record or SpContainer.
|
||||
*/
|
||||
private function readOPT()
|
||||
{
|
||||
|
@ -402,7 +403,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read TertiaryOPT record
|
||||
* Read TertiaryOPT record.
|
||||
*/
|
||||
private function readTertiaryOPT()
|
||||
{
|
||||
|
@ -419,7 +420,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read SplitMenuColors record
|
||||
* Read SplitMenuColors record.
|
||||
*/
|
||||
private function readSplitMenuColors()
|
||||
{
|
||||
|
@ -431,7 +432,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read DgContainer record (Drawing Container)
|
||||
* Read DgContainer record (Drawing Container).
|
||||
*/
|
||||
private function readDgContainer()
|
||||
{
|
||||
|
@ -449,7 +450,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read Dg record (Drawing)
|
||||
* Read Dg record (Drawing).
|
||||
*/
|
||||
private function readDg()
|
||||
{
|
||||
|
@ -461,7 +462,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read SpgrContainer record (Shape Group Container)
|
||||
* Read SpgrContainer record (Shape Group Container).
|
||||
*/
|
||||
private function readSpgrContainer()
|
||||
{
|
||||
|
@ -489,7 +490,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read SpContainer record (Shape Container)
|
||||
* Read SpContainer record (Shape Container).
|
||||
*/
|
||||
private function readSpContainer()
|
||||
{
|
||||
|
@ -509,7 +510,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read Spgr record (Shape Group)
|
||||
* Read Spgr record (Shape Group).
|
||||
*/
|
||||
private function readSpgr()
|
||||
{
|
||||
|
@ -521,7 +522,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read Sp record (Shape)
|
||||
* Read Sp record (Shape).
|
||||
*/
|
||||
private function readSp()
|
||||
{
|
||||
|
@ -538,7 +539,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read ClientTextbox record
|
||||
* Read ClientTextbox record.
|
||||
*/
|
||||
private function readClientTextbox()
|
||||
{
|
||||
|
@ -555,7 +556,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read ClientAnchor record. This record holds information about where the shape is anchored in worksheet
|
||||
* Read ClientAnchor record. This record holds information about where the shape is anchored in worksheet.
|
||||
*/
|
||||
private function readClientAnchor()
|
||||
{
|
||||
|
@ -609,7 +610,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read ClientData record
|
||||
* Read ClientData record.
|
||||
*/
|
||||
private function readClientData()
|
||||
{
|
||||
|
@ -621,7 +622,7 @@ class Escher
|
|||
}
|
||||
|
||||
/**
|
||||
* Read OfficeArtRGFOPTE table of property-value pairs
|
||||
* Read OfficeArtRGFOPTE table of property-value pairs.
|
||||
*
|
||||
* @param string $data Binary data
|
||||
* @param int $n Number of properties
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Reader\Xls;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xls;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -32,7 +33,7 @@ class MD5
|
|||
private $d;
|
||||
|
||||
/**
|
||||
* MD5 stream constructor
|
||||
* MD5 stream constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -40,7 +41,7 @@ class MD5
|
|||
}
|
||||
|
||||
/**
|
||||
* Reset the MD5 stream context
|
||||
* Reset the MD5 stream context.
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
|
@ -51,7 +52,7 @@ class MD5
|
|||
}
|
||||
|
||||
/**
|
||||
* Get MD5 stream context
|
||||
* Get MD5 stream context.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -70,7 +71,7 @@ class MD5
|
|||
}
|
||||
|
||||
/**
|
||||
* Add data to context
|
||||
* Add data to context.
|
||||
*
|
||||
* @param string $data Data to add
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Reader\Xls;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xls;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -31,7 +32,7 @@ class RC4
|
|||
protected $j = 0;
|
||||
|
||||
/**
|
||||
* RC4 stream decryption/encryption constrcutor
|
||||
* RC4 stream decryption/encryption constrcutor.
|
||||
*
|
||||
* @param string $key Encryption key/passphrase
|
||||
*/
|
||||
|
@ -54,7 +55,7 @@ class RC4
|
|||
}
|
||||
|
||||
/**
|
||||
* Symmetric decryption/encryption function
|
||||
* Symmetric decryption/encryption function.
|
||||
*
|
||||
* @param string $data Data to encrypt/decrypt
|
||||
*
|
||||
|
|
|
@ -25,9 +25,10 @@ class Border
|
|||
|
||||
/**
|
||||
* Map border style
|
||||
* OpenOffice documentation: 2.5.11
|
||||
* OpenOffice documentation: 2.5.11.
|
||||
*
|
||||
* @param int $index
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function lookup($index)
|
||||
|
|
|
@ -30,9 +30,10 @@ class FillPattern
|
|||
|
||||
/**
|
||||
* Get fill pattern from index
|
||||
* OpenOffice documentation: 2.5.12
|
||||
* OpenOffice documentation: 2.5.12.
|
||||
*
|
||||
* @param int $index
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function lookup($index)
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader;
|
|||
use PhpOffice\PhpSpreadsheet\Shared\File;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -22,27 +22,28 @@ use PhpOffice\PhpSpreadsheet\Shared\File;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Xlsx extends BaseReader implements IReader
|
||||
{
|
||||
/**
|
||||
* ReferenceHelper instance
|
||||
* ReferenceHelper instance.
|
||||
*
|
||||
* @var \PhpOffice\PhpSpreadsheet\ReferenceHelper
|
||||
*/
|
||||
private $referenceHelper = null;
|
||||
|
||||
/**
|
||||
* Xlsx\Theme instance
|
||||
* Xlsx\Theme instance.
|
||||
*
|
||||
* @var Xlsx\Theme
|
||||
*/
|
||||
private static $theme = null;
|
||||
|
||||
/**
|
||||
* Create a new Xlsx Reader instance
|
||||
* Create a new Xlsx Reader instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -54,7 +55,9 @@ class Xlsx extends BaseReader implements IReader
|
|||
* Can the current IReader read the file?
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canRead($pFilename)
|
||||
|
@ -98,9 +101,10 @@ class Xlsx extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object
|
||||
* Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object.
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function listWorksheetNames($pFilename)
|
||||
|
@ -140,9 +144,10 @@ class Xlsx extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns).
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function listWorksheetInfo($pFilename)
|
||||
|
@ -248,10 +253,9 @@ class Xlsx extends BaseReader implements IReader
|
|||
return false;
|
||||
} elseif ($value == '1') {
|
||||
return true;
|
||||
} else {
|
||||
return (bool) $c->v;
|
||||
}
|
||||
|
||||
return (bool) $c->v;
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
@ -315,10 +319,12 @@ class Xlsx extends BaseReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads Spreadsheet from file
|
||||
* Loads Spreadsheet from file.
|
||||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return Spreadsheet
|
||||
*/
|
||||
public function load($pFilename)
|
||||
|
@ -553,14 +559,14 @@ class Xlsx extends BaseReader implements IReader
|
|||
}
|
||||
$quotePrefix = false;
|
||||
if (isset($xf['quotePrefix'])) {
|
||||
$quotePrefix = (boolean) $xf['quotePrefix'];
|
||||
$quotePrefix = (bool) $xf['quotePrefix'];
|
||||
}
|
||||
|
||||
$style = (object) [
|
||||
'numFmt' => $numFmt,
|
||||
'font' => $xmlStyles->fonts->font[intval($xf['fontId'])],
|
||||
'fill' => $xmlStyles->fills->fill[intval($xf['fillId'])],
|
||||
'border' => $xmlStyles->borders->border[intval($xf['borderId'])],
|
||||
'font' => $xmlStyles->fonts->font[(int) ($xf['fontId'])],
|
||||
'fill' => $xmlStyles->fills->fill[(int) ($xf['fillId'])],
|
||||
'border' => $xmlStyles->borders->border[(int) ($xf['borderId'])],
|
||||
'alignment' => $xf->alignment,
|
||||
'protection' => $xf->protection,
|
||||
'quotePrefix' => $quotePrefix,
|
||||
|
@ -586,9 +592,9 @@ class Xlsx extends BaseReader implements IReader
|
|||
|
||||
$cellStyle = (object) [
|
||||
'numFmt' => $numFmt,
|
||||
'font' => $xmlStyles->fonts->font[intval($xf['fontId'])],
|
||||
'fill' => $xmlStyles->fills->fill[intval($xf['fillId'])],
|
||||
'border' => $xmlStyles->borders->border[intval($xf['borderId'])],
|
||||
'font' => $xmlStyles->fonts->font[(int) ($xf['fontId'])],
|
||||
'fill' => $xmlStyles->fills->fill[(int) ($xf['fillId'])],
|
||||
'border' => $xmlStyles->borders->border[(int) ($xf['borderId'])],
|
||||
'alignment' => $xf->alignment,
|
||||
'protection' => $xf->protection,
|
||||
'quotePrefix' => $quotePrefix,
|
||||
|
@ -615,11 +621,11 @@ class Xlsx extends BaseReader implements IReader
|
|||
// Cell Styles
|
||||
if ($xmlStyles->cellStyles) {
|
||||
foreach ($xmlStyles->cellStyles->cellStyle as $cellStyle) {
|
||||
if (intval($cellStyle['builtinId']) == 0) {
|
||||
if (isset($cellStyles[intval($cellStyle['xfId'])])) {
|
||||
if ((int) ($cellStyle['builtinId']) == 0) {
|
||||
if (isset($cellStyles[(int) ($cellStyle['xfId'])])) {
|
||||
// Set default style
|
||||
$style = new \PhpOffice\PhpSpreadsheet\Style();
|
||||
self::readStyle($style, $cellStyles[intval($cellStyle['xfId'])]);
|
||||
self::readStyle($style, $cellStyles[(int) ($cellStyle['xfId'])]);
|
||||
|
||||
// normal style, currently not using it for anything
|
||||
}
|
||||
|
@ -690,10 +696,10 @@ class Xlsx extends BaseReader implements IReader
|
|||
|
||||
if (isset($xmlSheet->sheetViews) && isset($xmlSheet->sheetViews->sheetView)) {
|
||||
if (isset($xmlSheet->sheetViews->sheetView['zoomScale'])) {
|
||||
$docSheet->getSheetView()->setZoomScale(intval($xmlSheet->sheetViews->sheetView['zoomScale']));
|
||||
$docSheet->getSheetView()->setZoomScale((int) ($xmlSheet->sheetViews->sheetView['zoomScale']));
|
||||
}
|
||||
if (isset($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])) {
|
||||
$docSheet->getSheetView()->setZoomScaleNormal(intval($xmlSheet->sheetViews->sheetView['zoomScaleNormal']));
|
||||
$docSheet->getSheetView()->setZoomScaleNormal((int) ($xmlSheet->sheetViews->sheetView['zoomScaleNormal']));
|
||||
}
|
||||
if (isset($xmlSheet->sheetViews->sheetView['view'])) {
|
||||
$docSheet->getSheetView()->setView((string) $xmlSheet->sheetViews->sheetView['view']);
|
||||
|
@ -715,11 +721,11 @@ class Xlsx extends BaseReader implements IReader
|
|||
$ySplit = 0;
|
||||
|
||||
if (isset($xmlSheet->sheetViews->sheetView->pane['xSplit'])) {
|
||||
$xSplit = 1 + intval($xmlSheet->sheetViews->sheetView->pane['xSplit']);
|
||||
$xSplit = 1 + (int) ($xmlSheet->sheetViews->sheetView->pane['xSplit']);
|
||||
}
|
||||
|
||||
if (isset($xmlSheet->sheetViews->sheetView->pane['ySplit'])) {
|
||||
$ySplit = 1 + intval($xmlSheet->sheetViews->sheetView->pane['ySplit']);
|
||||
$ySplit = 1 + (int) ($xmlSheet->sheetViews->sheetView->pane['ySplit']);
|
||||
}
|
||||
|
||||
$docSheet->freezePaneByColumnAndRow($xSplit, $ySplit);
|
||||
|
@ -786,9 +792,9 @@ class Xlsx extends BaseReader implements IReader
|
|||
|
||||
if (isset($xmlSheet->cols) && !$this->readDataOnly) {
|
||||
foreach ($xmlSheet->cols->col as $col) {
|
||||
for ($i = intval($col['min']) - 1; $i < intval($col['max']); ++$i) {
|
||||
for ($i = (int) ($col['min']) - 1; $i < (int) ($col['max']); ++$i) {
|
||||
if ($col['style'] && !$this->readDataOnly) {
|
||||
$docSheet->getColumnDimension(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($i))->setXfIndex(intval($col['style']));
|
||||
$docSheet->getColumnDimension(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($i))->setXfIndex((int) ($col['style']));
|
||||
}
|
||||
if (self::boolean($col['hidden'])) {
|
||||
$docSheet->getColumnDimension(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($i))->setVisible(false);
|
||||
|
@ -797,11 +803,11 @@ class Xlsx extends BaseReader implements IReader
|
|||
$docSheet->getColumnDimension(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($i))->setCollapsed(true);
|
||||
}
|
||||
if ($col['outlineLevel'] > 0) {
|
||||
$docSheet->getColumnDimension(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($i))->setOutlineLevel(intval($col['outlineLevel']));
|
||||
$docSheet->getColumnDimension(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($i))->setOutlineLevel((int) ($col['outlineLevel']));
|
||||
}
|
||||
$docSheet->getColumnDimension(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($i))->setWidth(floatval($col['width']));
|
||||
$docSheet->getColumnDimension(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($i))->setWidth((float) ($col['width']));
|
||||
|
||||
if (intval($col['max']) == 16384) {
|
||||
if ((int) ($col['max']) == 16384) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -826,19 +832,19 @@ class Xlsx extends BaseReader implements IReader
|
|||
if ($xmlSheet && $xmlSheet->sheetData && $xmlSheet->sheetData->row) {
|
||||
foreach ($xmlSheet->sheetData->row as $row) {
|
||||
if ($row['ht'] && !$this->readDataOnly) {
|
||||
$docSheet->getRowDimension(intval($row['r']))->setRowHeight(floatval($row['ht']));
|
||||
$docSheet->getRowDimension((int) ($row['r']))->setRowHeight((float) ($row['ht']));
|
||||
}
|
||||
if (self::boolean($row['hidden']) && !$this->readDataOnly) {
|
||||
$docSheet->getRowDimension(intval($row['r']))->setVisible(false);
|
||||
$docSheet->getRowDimension((int) ($row['r']))->setVisible(false);
|
||||
}
|
||||
if (self::boolean($row['collapsed'])) {
|
||||
$docSheet->getRowDimension(intval($row['r']))->setCollapsed(true);
|
||||
$docSheet->getRowDimension((int) ($row['r']))->setCollapsed(true);
|
||||
}
|
||||
if ($row['outlineLevel'] > 0) {
|
||||
$docSheet->getRowDimension(intval($row['r']))->setOutlineLevel(intval($row['outlineLevel']));
|
||||
$docSheet->getRowDimension((int) ($row['r']))->setOutlineLevel((int) ($row['outlineLevel']));
|
||||
}
|
||||
if ($row['s'] && !$this->readDataOnly) {
|
||||
$docSheet->getRowDimension(intval($row['r']))->setXfIndex(intval($row['s']));
|
||||
$docSheet->getRowDimension((int) ($row['r']))->setXfIndex((int) ($row['s']));
|
||||
}
|
||||
|
||||
foreach ($row->c as $c) {
|
||||
|
@ -860,7 +866,7 @@ class Xlsx extends BaseReader implements IReader
|
|||
switch ($cellDataType) {
|
||||
case 's':
|
||||
if ((string) $c->v != '') {
|
||||
$value = $sharedStrings[intval($c->v)];
|
||||
$value = $sharedStrings[(int) ($c->v)];
|
||||
|
||||
if ($value instanceof \PhpOffice\PhpSpreadsheet\RichText) {
|
||||
$value = clone $value;
|
||||
|
@ -913,8 +919,8 @@ class Xlsx extends BaseReader implements IReader
|
|||
$value = (int) $value;
|
||||
} elseif ($value == (float) $value) {
|
||||
$value = (float) $value;
|
||||
} elseif ($value == (double) $value) {
|
||||
$value = (double) $value;
|
||||
} elseif ($value == (float) $value) {
|
||||
$value = (float) $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -937,8 +943,8 @@ class Xlsx extends BaseReader implements IReader
|
|||
// Style information?
|
||||
if ($c['s'] && !$this->readDataOnly) {
|
||||
// no style index means 0, it seems
|
||||
$cell->setXfIndex(isset($styles[intval($c['s'])]) ?
|
||||
intval($c['s']) : 0);
|
||||
$cell->setXfIndex(isset($styles[(int) ($c['s'])]) ?
|
||||
(int) ($c['s']) : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -948,8 +954,8 @@ class Xlsx extends BaseReader implements IReader
|
|||
if (!$this->readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) {
|
||||
foreach ($xmlSheet->conditionalFormatting as $conditional) {
|
||||
foreach ($conditional->cfRule as $cfRule) {
|
||||
if (((string) $cfRule['type'] == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_NONE || (string) $cfRule['type'] == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS || (string) $cfRule['type'] == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CONTAINSTEXT || (string) $cfRule['type'] == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_EXPRESSION) && isset($dxfs[intval($cfRule['dxfId'])])) {
|
||||
$conditionals[(string) $conditional['sqref']][intval($cfRule['priority'])] = $cfRule;
|
||||
if (((string) $cfRule['type'] == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_NONE || (string) $cfRule['type'] == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS || (string) $cfRule['type'] == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CONTAINSTEXT || (string) $cfRule['type'] == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_EXPRESSION) && isset($dxfs[(int) ($cfRule['dxfId'])])) {
|
||||
$conditionals[(string) $conditional['sqref']][(int) ($cfRule['priority'])] = $cfRule;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -973,7 +979,7 @@ class Xlsx extends BaseReader implements IReader
|
|||
} else {
|
||||
$objConditional->addCondition((string) $cfRule->formula);
|
||||
}
|
||||
$objConditional->setStyle(clone $dxfs[intval($cfRule['dxfId'])]);
|
||||
$objConditional->setStyle(clone $dxfs[(int) ($cfRule['dxfId'])]);
|
||||
$conditionalStyles[] = $objConditional;
|
||||
}
|
||||
|
||||
|
@ -1009,7 +1015,7 @@ class Xlsx extends BaseReader implements IReader
|
|||
$autoFilter->setRange($autoFilterRange);
|
||||
|
||||
foreach ($xmlSheet->autoFilter->filterColumn as $filterColumn) {
|
||||
$column = $autoFilter->getColumnByOffset((integer) $filterColumn['colId']);
|
||||
$column = $autoFilter->getColumnByOffset((int) $filterColumn['colId']);
|
||||
// Check for standard filters
|
||||
if ($filterColumn->filters) {
|
||||
$column->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER);
|
||||
|
@ -1113,12 +1119,12 @@ class Xlsx extends BaseReader implements IReader
|
|||
|
||||
if ($xmlSheet && $xmlSheet->pageMargins && !$this->readDataOnly) {
|
||||
$docPageMargins = $docSheet->getPageMargins();
|
||||
$docPageMargins->setLeft(floatval($xmlSheet->pageMargins['left']));
|
||||
$docPageMargins->setRight(floatval($xmlSheet->pageMargins['right']));
|
||||
$docPageMargins->setTop(floatval($xmlSheet->pageMargins['top']));
|
||||
$docPageMargins->setBottom(floatval($xmlSheet->pageMargins['bottom']));
|
||||
$docPageMargins->setHeader(floatval($xmlSheet->pageMargins['header']));
|
||||
$docPageMargins->setFooter(floatval($xmlSheet->pageMargins['footer']));
|
||||
$docPageMargins->setLeft((float) ($xmlSheet->pageMargins['left']));
|
||||
$docPageMargins->setRight((float) ($xmlSheet->pageMargins['right']));
|
||||
$docPageMargins->setTop((float) ($xmlSheet->pageMargins['top']));
|
||||
$docPageMargins->setBottom((float) ($xmlSheet->pageMargins['bottom']));
|
||||
$docPageMargins->setHeader((float) ($xmlSheet->pageMargins['header']));
|
||||
$docPageMargins->setFooter((float) ($xmlSheet->pageMargins['footer']));
|
||||
}
|
||||
|
||||
if ($xmlSheet && $xmlSheet->pageSetup && !$this->readDataOnly) {
|
||||
|
@ -1128,20 +1134,20 @@ class Xlsx extends BaseReader implements IReader
|
|||
$docPageSetup->setOrientation((string) $xmlSheet->pageSetup['orientation']);
|
||||
}
|
||||
if (isset($xmlSheet->pageSetup['paperSize'])) {
|
||||
$docPageSetup->setPaperSize(intval($xmlSheet->pageSetup['paperSize']));
|
||||
$docPageSetup->setPaperSize((int) ($xmlSheet->pageSetup['paperSize']));
|
||||
}
|
||||
if (isset($xmlSheet->pageSetup['scale'])) {
|
||||
$docPageSetup->setScale(intval($xmlSheet->pageSetup['scale']), false);
|
||||
$docPageSetup->setScale((int) ($xmlSheet->pageSetup['scale']), false);
|
||||
}
|
||||
if (isset($xmlSheet->pageSetup['fitToHeight']) && intval($xmlSheet->pageSetup['fitToHeight']) >= 0) {
|
||||
$docPageSetup->setFitToHeight(intval($xmlSheet->pageSetup['fitToHeight']), false);
|
||||
if (isset($xmlSheet->pageSetup['fitToHeight']) && (int) ($xmlSheet->pageSetup['fitToHeight']) >= 0) {
|
||||
$docPageSetup->setFitToHeight((int) ($xmlSheet->pageSetup['fitToHeight']), false);
|
||||
}
|
||||
if (isset($xmlSheet->pageSetup['fitToWidth']) && intval($xmlSheet->pageSetup['fitToWidth']) >= 0) {
|
||||
$docPageSetup->setFitToWidth(intval($xmlSheet->pageSetup['fitToWidth']), false);
|
||||
if (isset($xmlSheet->pageSetup['fitToWidth']) && (int) ($xmlSheet->pageSetup['fitToWidth']) >= 0) {
|
||||
$docPageSetup->setFitToWidth((int) ($xmlSheet->pageSetup['fitToWidth']), false);
|
||||
}
|
||||
if (isset($xmlSheet->pageSetup['firstPageNumber']) && isset($xmlSheet->pageSetup['useFirstPageNumber']) &&
|
||||
self::boolean((string) $xmlSheet->pageSetup['useFirstPageNumber'])) {
|
||||
$docPageSetup->setFirstPageNumber(intval($xmlSheet->pageSetup['firstPageNumber']));
|
||||
$docPageSetup->setFirstPageNumber((int) ($xmlSheet->pageSetup['firstPageNumber']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1693,7 +1699,6 @@ class Xlsx extends BaseReader implements IReader
|
|||
}
|
||||
$docSheet->getPageSetup()->setPrintArea(implode(',', $newRangeSets));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1731,14 +1736,14 @@ class Xlsx extends BaseReader implements IReader
|
|||
case '_xlnm.Print_Area':
|
||||
break;
|
||||
default:
|
||||
if ($mapSheetId[(integer) $definedName['localSheetId']] !== null) {
|
||||
if ($mapSheetId[(int) $definedName['localSheetId']] !== null) {
|
||||
$range = explode('!', (string) $definedName);
|
||||
if (count($range) == 2) {
|
||||
$range[0] = str_replace("''", "'", $range[0]);
|
||||
$range[0] = str_replace("'", '', $range[0]);
|
||||
if ($worksheet = $docSheet->getParent()->getSheetByName($range[0])) {
|
||||
$extractedRange = str_replace('$', '', $range[1]);
|
||||
$scope = $docSheet->getParent()->getSheet($mapSheetId[(integer) $definedName['localSheetId']]);
|
||||
$scope = $docSheet->getParent()->getSheet($mapSheetId[(int) $definedName['localSheetId']]);
|
||||
$excel->addNamedRange(new \PhpOffice\PhpSpreadsheet\NamedRange((string) $definedName['name'], $worksheet, $extractedRange, true, $scope));
|
||||
}
|
||||
}
|
||||
|
@ -1772,7 +1777,7 @@ class Xlsx extends BaseReader implements IReader
|
|||
|
||||
if ((!$this->readDataOnly) || (!empty($this->loadSheetsOnly))) {
|
||||
// active sheet index
|
||||
$activeTab = intval($xmlWorkbook->bookViews->workbookView['activeTab']); // refers to old sheet index
|
||||
$activeTab = (int) ($xmlWorkbook->bookViews->workbookView['activeTab']); // refers to old sheet index
|
||||
|
||||
// keep active sheet index if sheet is still loaded, else first sheet is set as the active
|
||||
if (isset($mapSheetId[$activeTab]) && $mapSheetId[$activeTab] !== null) {
|
||||
|
@ -1901,7 +1906,7 @@ class Xlsx extends BaseReader implements IReader
|
|||
if (!empty($gradientFill['type'])) {
|
||||
$docStyle->getFill()->setFillType((string) $gradientFill['type']);
|
||||
}
|
||||
$docStyle->getFill()->setRotation(floatval($gradientFill['degree']));
|
||||
$docStyle->getFill()->setRotation((float) ($gradientFill['degree']));
|
||||
$gradientFill->registerXPathNamespace('sml', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
|
||||
$docStyle->getFill()->getStartColor()->setARGB(self::readColor(self::getArrayItem($gradientFill->xpath('sml:stop[@position=0]'))->color));
|
||||
$docStyle->getFill()->getEndColor()->setARGB(self::readColor(self::getArrayItem($gradientFill->xpath('sml:stop[@position=1]'))->color));
|
||||
|
@ -1951,11 +1956,11 @@ class Xlsx extends BaseReader implements IReader
|
|||
$textRotation = 90 - (int) $style->alignment['textRotation'];
|
||||
}
|
||||
|
||||
$docStyle->getAlignment()->setTextRotation(intval($textRotation));
|
||||
$docStyle->getAlignment()->setTextRotation((int) $textRotation);
|
||||
$docStyle->getAlignment()->setWrapText(self::boolean((string) $style->alignment['wrapText']));
|
||||
$docStyle->getAlignment()->setShrinkToFit(self::boolean((string) $style->alignment['shrinkToFit']));
|
||||
$docStyle->getAlignment()->setIndent(intval((string) $style->alignment['indent']) > 0 ? intval((string) $style->alignment['indent']) : 0);
|
||||
$docStyle->getAlignment()->setReadorder(intval((string) $style->alignment['readingOrder']) > 0 ? intval((string) $style->alignment['readingOrder']) : 0);
|
||||
$docStyle->getAlignment()->setIndent((int) ((string) $style->alignment['indent']) > 0 ? (int) ((string) $style->alignment['indent']) : 0);
|
||||
$docStyle->getAlignment()->setReadorder((int) ((string) $style->alignment['readingOrder']) > 0 ? (int) ((string) $style->alignment['readingOrder']) : 0);
|
||||
}
|
||||
|
||||
// protection
|
||||
|
@ -2052,6 +2057,8 @@ class Xlsx extends BaseReader implements IReader
|
|||
|
||||
/**
|
||||
* @param \PhpOffice\PhpSpreadsheet\Spreadsheet $excel
|
||||
* @param mixed $customUITarget
|
||||
* @param mixed $zip
|
||||
*/
|
||||
private function readRibbon(\PhpOffice\PhpSpreadsheet\Spreadsheet $excel, $customUITarget, $zip)
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
|||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -22,6 +22,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -39,12 +40,12 @@ class Chart
|
|||
if ($format == 'string') {
|
||||
return (string) $attributes[$name];
|
||||
} elseif ($format == 'integer') {
|
||||
return (integer) $attributes[$name];
|
||||
return (int) $attributes[$name];
|
||||
} elseif ($format == 'boolean') {
|
||||
return (boolean) ($attributes[$name] === '0' || $attributes[$name] !== 'true') ? false : true;
|
||||
} else {
|
||||
return (float) $attributes[$name];
|
||||
return (bool) ($attributes[$name] === '0' || $attributes[$name] !== 'true') ? false : true;
|
||||
}
|
||||
|
||||
return (float) $attributes[$name];
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -497,6 +498,7 @@ class Chart
|
|||
|
||||
/**
|
||||
* @param \PhpOffice\PhpSpreadsheet\Chart\Layout $plotArea
|
||||
* @param mixed $plotAttributes
|
||||
*/
|
||||
private static function setChartAttributes(\PhpOffice\PhpSpreadsheet\Chart\Layout $plotArea, $plotAttributes)
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,41 +20,46 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Theme
|
||||
{
|
||||
/**
|
||||
* Theme Name
|
||||
* Theme Name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $themeName;
|
||||
|
||||
/**
|
||||
* Colour Scheme Name
|
||||
* Colour Scheme Name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $colourSchemeName;
|
||||
|
||||
/**
|
||||
* Colour Map indexed by position
|
||||
* Colour Map indexed by position.
|
||||
*
|
||||
* @var array of string
|
||||
*/
|
||||
private $colourMapValues;
|
||||
|
||||
/**
|
||||
* Colour Map
|
||||
* Colour Map.
|
||||
*
|
||||
* @var array of string
|
||||
*/
|
||||
private $colourMap;
|
||||
|
||||
/**
|
||||
* Create a new Theme
|
||||
* Create a new Theme.
|
||||
*
|
||||
* @param mixed $themeName
|
||||
* @param mixed $colourSchemeName
|
||||
* @param mixed $colourMap
|
||||
*/
|
||||
public function __construct($themeName, $colourSchemeName, $colourMap)
|
||||
{
|
||||
|
@ -65,7 +70,7 @@ class Theme
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Theme Name
|
||||
* Get Theme Name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -75,7 +80,7 @@ class Theme
|
|||
}
|
||||
|
||||
/**
|
||||
* Get colour Scheme Name
|
||||
* Get colour Scheme Name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -85,7 +90,9 @@ class Theme
|
|||
}
|
||||
|
||||
/**
|
||||
* Get colour Map Value by Position
|
||||
* Get colour Map Value by Position.
|
||||
*
|
||||
* @param mixed $index
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
@ -33,14 +34,14 @@ class ReferenceHelper
|
|||
const REFHELPER_REGEXP_COLRANGE = '((\w*|\'[^!]*\')!)?(\$?[a-z]{1,3}):(\$?[a-z]{1,3})';
|
||||
|
||||
/**
|
||||
* Instance of this class
|
||||
* Instance of this class.
|
||||
*
|
||||
* @var ReferenceHelper
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Get an instance of this class
|
||||
* Get an instance of this class.
|
||||
*
|
||||
* @return ReferenceHelper
|
||||
*/
|
||||
|
@ -54,7 +55,7 @@ class ReferenceHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a new ReferenceHelper
|
||||
* Create a new ReferenceHelper.
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
|
@ -62,10 +63,11 @@ class ReferenceHelper
|
|||
|
||||
/**
|
||||
* Compare two column addresses
|
||||
* Intended for use as a Callback function for sorting column addresses by column
|
||||
* Intended for use as a Callback function for sorting column addresses by column.
|
||||
*
|
||||
* @param string $a First column to test (e.g. 'AA')
|
||||
* @param string $b Second column to test (e.g. 'Z')
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function columnSort($a, $b)
|
||||
|
@ -75,10 +77,11 @@ class ReferenceHelper
|
|||
|
||||
/**
|
||||
* Compare two column addresses
|
||||
* Intended for use as a Callback function for reverse sorting column addresses by column
|
||||
* Intended for use as a Callback function for reverse sorting column addresses by column.
|
||||
*
|
||||
* @param string $a First column to test (e.g. 'AA')
|
||||
* @param string $b Second column to test (e.g. 'Z')
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function columnReverseSort($a, $b)
|
||||
|
@ -88,10 +91,11 @@ class ReferenceHelper
|
|||
|
||||
/**
|
||||
* Compare two cell addresses
|
||||
* Intended for use as a Callback function for sorting cell addresses by column and row
|
||||
* Intended for use as a Callback function for sorting cell addresses by column and row.
|
||||
*
|
||||
* @param string $a First cell to test (e.g. 'AA1')
|
||||
* @param string $b Second cell to test (e.g. 'Z1')
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function cellSort($a, $b)
|
||||
|
@ -108,10 +112,11 @@ class ReferenceHelper
|
|||
|
||||
/**
|
||||
* Compare two cell addresses
|
||||
* Intended for use as a Callback function for sorting cell addresses by column and row
|
||||
* Intended for use as a Callback function for sorting cell addresses by column and row.
|
||||
*
|
||||
* @param string $a First cell to test (e.g. 'AA1')
|
||||
* @param string $b Second cell to test (e.g. 'Z1')
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function cellReverseSort($a, $b)
|
||||
|
@ -127,13 +132,14 @@ class ReferenceHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Test whether a cell address falls within a defined range of cells
|
||||
* Test whether a cell address falls within a defined range of cells.
|
||||
*
|
||||
* @param string $cellAddress Address of the cell we're testing
|
||||
* @param int $beforeRow Number of the row we're inserting/deleting before
|
||||
* @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
* @param int $beforeColumnIndex Index number of the column we're inserting/deleting before
|
||||
* @param int $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)
|
||||
|
@ -155,7 +161,7 @@ class ReferenceHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Update page breaks when inserting/deleting rows/columns
|
||||
* Update page breaks when inserting/deleting rows/columns.
|
||||
*
|
||||
* @param Worksheet $pSheet The worksheet that we're editing
|
||||
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||
|
@ -188,7 +194,7 @@ class ReferenceHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Update cell comments when inserting/deleting rows/columns
|
||||
* Update cell comments when inserting/deleting rows/columns.
|
||||
*
|
||||
* @param Worksheet $pSheet The worksheet that we're editing
|
||||
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||
|
@ -215,7 +221,7 @@ class ReferenceHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Update hyperlinks when inserting/deleting rows/columns
|
||||
* Update hyperlinks when inserting/deleting rows/columns.
|
||||
*
|
||||
* @param Worksheet $pSheet The worksheet that we're editing
|
||||
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||
|
@ -240,7 +246,7 @@ class ReferenceHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Update data validations when inserting/deleting rows/columns
|
||||
* Update data validations when inserting/deleting rows/columns.
|
||||
*
|
||||
* @param Worksheet $pSheet The worksheet that we're editing
|
||||
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||
|
@ -265,7 +271,7 @@ class ReferenceHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Update merged cells when inserting/deleting rows/columns
|
||||
* Update merged cells when inserting/deleting rows/columns.
|
||||
*
|
||||
* @param Worksheet $pSheet The worksheet that we're editing
|
||||
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||
|
@ -286,7 +292,7 @@ class ReferenceHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Update protected cells when inserting/deleting rows/columns
|
||||
* Update protected cells when inserting/deleting rows/columns.
|
||||
*
|
||||
* @param Worksheet $pSheet The worksheet that we're editing
|
||||
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||
|
@ -310,7 +316,7 @@ class ReferenceHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Update column dimensions when inserting/deleting rows/columns
|
||||
* Update column dimensions when inserting/deleting rows/columns.
|
||||
*
|
||||
* @param Worksheet $pSheet The worksheet that we're editing
|
||||
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||
|
@ -335,7 +341,7 @@ class ReferenceHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Update row dimensions when inserting/deleting rows/columns
|
||||
* Update row dimensions when inserting/deleting rows/columns.
|
||||
*
|
||||
* @param Worksheet $pSheet The worksheet that we're editing
|
||||
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||
|
@ -369,12 +375,13 @@ class ReferenceHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Insert a new column or row, updating all possible related data
|
||||
* Insert a new column or row, updating all possible related data.
|
||||
*
|
||||
* @param string $pBefore Insert before this cell address (e.g. 'A1')
|
||||
* @param int $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||
* @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
* @param Worksheet $pSheet The worksheet that we're editing
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, Worksheet $pSheet = null)
|
||||
|
@ -626,14 +633,16 @@ class ReferenceHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Update references within formulas
|
||||
* Update references within formulas.
|
||||
*
|
||||
* @param string $pFormula Formula to update
|
||||
* @param int $pBefore Insert before this one
|
||||
* @param int $pNumCols Number of columns to insert
|
||||
* @param int $pNumRows Number of rows to insert
|
||||
* @param string $sheetName Worksheet name/title
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return string Updated formula
|
||||
*/
|
||||
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '')
|
||||
|
@ -767,13 +776,15 @@ class ReferenceHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Update cell reference
|
||||
* Update cell reference.
|
||||
*
|
||||
* @param string $pCellRange Cell range
|
||||
* @param int $pBefore Insert before this one
|
||||
* @param int $pNumCols Number of columns to increment
|
||||
* @param int $pNumRows Number of rows to increment
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return string Updated cell range
|
||||
*/
|
||||
public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
|
||||
|
@ -788,14 +799,13 @@ class ReferenceHelper
|
|||
} elseif (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) {
|
||||
// Range
|
||||
return $this->updateCellRange($pCellRange, $pBefore, $pNumCols, $pNumRows);
|
||||
} else {
|
||||
}
|
||||
// Return original
|
||||
return $pCellRange;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update named formulas (i.e. containing worksheet references / named ranges)
|
||||
* Update named formulas (i.e. containing worksheet references / named ranges).
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet Object to update
|
||||
* @param string $oldName Old name (name to replace)
|
||||
|
@ -823,13 +833,15 @@ class ReferenceHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Update cell range
|
||||
* Update cell range.
|
||||
*
|
||||
* @param string $pCellRange Cell range (e.g. 'B2:D4', 'B:C' or '2:3')
|
||||
* @param int $pBefore Insert before this one
|
||||
* @param int $pNumCols Number of columns to increment
|
||||
* @param int $pNumRows Number of rows to increment
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return string Updated cell range
|
||||
*/
|
||||
private function updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
|
||||
|
@ -855,19 +867,20 @@ class ReferenceHelper
|
|||
|
||||
// Recreate range string
|
||||
return Cell::buildRange($range);
|
||||
} else {
|
||||
throw new Exception('Only cell ranges may be passed to this method.');
|
||||
}
|
||||
throw new Exception('Only cell ranges may be passed to this method.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update single cell reference
|
||||
* Update single cell reference.
|
||||
*
|
||||
* @param string $pCellReference Single cell reference
|
||||
* @param int $pBefore Insert before this one
|
||||
* @param int $pNumCols Number of columns to increment
|
||||
* @param int $pNumRows Number of rows to increment
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return string Updated cell reference
|
||||
*/
|
||||
private function updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
|
||||
|
@ -880,8 +893,8 @@ class ReferenceHelper
|
|||
list($newColumn, $newRow) = Cell::coordinateFromString($pCellReference);
|
||||
|
||||
// Verify which parts should be updated
|
||||
$updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') && (Cell::columnIndexFromString($newColumn) >= Cell::columnIndexFromString($beforeColumn)));
|
||||
$updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') && $newRow >= $beforeRow);
|
||||
$updateColumn = (($newColumn[0] != '$') && ($beforeColumn[0] != '$') && (Cell::columnIndexFromString($newColumn) >= Cell::columnIndexFromString($beforeColumn)));
|
||||
$updateRow = (($newRow[0] != '$') && ($beforeRow[0] != '$') && $newRow >= $beforeRow);
|
||||
|
||||
// Create new column reference
|
||||
if ($updateColumn) {
|
||||
|
@ -895,9 +908,8 @@ class ReferenceHelper
|
|||
|
||||
// Return new reference
|
||||
return $newColumn . $newRow;
|
||||
} else {
|
||||
throw new Exception('Only single cell references may be passed to this method.');
|
||||
}
|
||||
throw new Exception('Only single cell references may be passed to this method.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,22 +20,24 @@ namespace PhpOffice\PhpSpreadsheet;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class RichText implements IComparable
|
||||
{
|
||||
/**
|
||||
* Rich text elements
|
||||
* Rich text elements.
|
||||
*
|
||||
* @var RichText\ITextElement[]
|
||||
*/
|
||||
private $richTextElements;
|
||||
|
||||
/**
|
||||
* Create a new RichText instance
|
||||
* Create a new RichText instance.
|
||||
*
|
||||
* @param Cell $pCell
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct(Cell $pCell = null)
|
||||
|
@ -58,10 +60,12 @@ class RichText implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Add text
|
||||
* Add text.
|
||||
*
|
||||
* @param RichText\ITextElement $pText Rich text element
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return RichText
|
||||
*/
|
||||
public function addText(RichText\ITextElement $pText = null)
|
||||
|
@ -72,10 +76,12 @@ class RichText implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Create text
|
||||
* Create text.
|
||||
*
|
||||
* @param string $pText Text
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return RichText\TextElement
|
||||
*/
|
||||
public function createText($pText = '')
|
||||
|
@ -87,10 +93,12 @@ class RichText implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Create text run
|
||||
* Create text run.
|
||||
*
|
||||
* @param string $pText Text
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return RichText\Run
|
||||
*/
|
||||
public function createTextRun($pText = '')
|
||||
|
@ -102,7 +110,7 @@ class RichText implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get plain text
|
||||
* Get plain text.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -120,7 +128,7 @@ class RichText implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Convert to string
|
||||
* Convert to string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -130,7 +138,7 @@ class RichText implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Rich Text elements
|
||||
* Get Rich Text elements.
|
||||
*
|
||||
* @return RichText\ITextElement[]
|
||||
*/
|
||||
|
@ -140,10 +148,12 @@ class RichText implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Rich Text elements
|
||||
* Set Rich Text elements.
|
||||
*
|
||||
* @param RichText\ITextElement[] $pElements Array of elements
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return RichText
|
||||
*/
|
||||
public function setRichTextElements($pElements = null)
|
||||
|
@ -158,7 +168,7 @@ class RichText implements IComparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
* Get hash code.
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
|
|
|
@ -18,35 +18,37 @@ namespace PhpOffice\PhpSpreadsheet\RichText;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
interface ITextElement
|
||||
{
|
||||
/**
|
||||
* Get text
|
||||
* Get text.
|
||||
*
|
||||
* @return string Text
|
||||
*/
|
||||
public function getText();
|
||||
|
||||
/**
|
||||
* Set text
|
||||
* Set text.
|
||||
*
|
||||
* @param $pText string Text
|
||||
*
|
||||
* @return ITextElement
|
||||
*/
|
||||
public function setText($pText = '');
|
||||
|
||||
/**
|
||||
* Get font
|
||||
* Get font.
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Style\Font
|
||||
*/
|
||||
public function getFont();
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
* Get hash code.
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
|
|
|
@ -18,20 +18,21 @@ namespace PhpOffice\PhpSpreadsheet\RichText;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Run extends TextElement implements ITextElement
|
||||
{
|
||||
/**
|
||||
* Font
|
||||
* Font.
|
||||
*
|
||||
* @var \PhpOffice\PhpSpreadsheet\Style\Font
|
||||
*/
|
||||
private $font;
|
||||
|
||||
/**
|
||||
* Create a new Run instance
|
||||
* Create a new Run instance.
|
||||
*
|
||||
* @param string $pText Text
|
||||
*/
|
||||
|
@ -43,7 +44,7 @@ class Run extends TextElement implements ITextElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Get font
|
||||
* Get font.
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Style\Font
|
||||
*/
|
||||
|
@ -53,10 +54,12 @@ class Run extends TextElement implements ITextElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Set font
|
||||
* Set font.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Style\Font $pFont Font
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return ITextElement
|
||||
*/
|
||||
public function setFont(\PhpOffice\PhpSpreadsheet\Style\Font $pFont = null)
|
||||
|
@ -67,7 +70,7 @@ class Run extends TextElement implements ITextElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
* Get hash code.
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
|
|
|
@ -18,20 +18,21 @@ namespace PhpOffice\PhpSpreadsheet\RichText;
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class TextElement implements ITextElement
|
||||
{
|
||||
/**
|
||||
* Text
|
||||
* Text.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $text;
|
||||
|
||||
/**
|
||||
* Create a new TextElement instance
|
||||
* Create a new TextElement instance.
|
||||
*
|
||||
* @param string $pText Text
|
||||
*/
|
||||
|
@ -42,7 +43,7 @@ class TextElement implements ITextElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Get text
|
||||
* Get text.
|
||||
*
|
||||
* @return string Text
|
||||
*/
|
||||
|
@ -52,9 +53,10 @@ class TextElement implements ITextElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Set text
|
||||
* Set text.
|
||||
*
|
||||
* @param $pText string Text
|
||||
*
|
||||
* @return ITextElement
|
||||
*/
|
||||
public function setText($pText = '')
|
||||
|
@ -65,7 +67,7 @@ class TextElement implements ITextElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Get font
|
||||
* Get font.
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Style\Font
|
||||
*/
|
||||
|
@ -75,7 +77,7 @@ class TextElement implements ITextElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
* Get hash code.
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue