mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-22 21:36:05 +03:00
Feature: Added strictNullComparison argument to the worksheet fromArray() method
git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@64270 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
parent
b25ced63cc
commit
6c9a41879b
@ -2082,7 +2082,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
/**
|
/**
|
||||||
* Set right-to-left
|
* Set right-to-left
|
||||||
*
|
*
|
||||||
* @param boolean $value Right-to-left true/false
|
* @param boolean $value Right-to-left true/false
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function setRightToLeft($value = false) {
|
public function setRightToLeft($value = false) {
|
||||||
@ -2093,23 +2093,32 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
/**
|
/**
|
||||||
* Fill worksheet from values in array
|
* Fill worksheet from values in array
|
||||||
*
|
*
|
||||||
* @param array $source Source array
|
* @param array $source Source array
|
||||||
* @param mixed $nullValue Value in source array that stands for blank cell
|
* @param mixed $nullValue Value in source array that stands for blank cell
|
||||||
|
* @param string $startCell Insert array starting from this cell address as the top left coordinate
|
||||||
|
* @param boolean $strictNullComparison Apply strict comparison when testing for null values in the array
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function fromArray($source = null, $nullValue = null, $pCell = 'A1') {
|
public function fromArray($source = null, $nullValue = null, $startCell = 'A1', $strictNullComparison = false) {
|
||||||
if (is_array($source)) {
|
if (is_array($source)) {
|
||||||
// start coordinate
|
// start coordinate
|
||||||
list ($startColumn, $startRow) = PHPExcel_Cell::coordinateFromString($pCell);
|
list ($startColumn, $startRow) = PHPExcel_Cell::coordinateFromString($startCell);
|
||||||
|
|
||||||
// Loop through $source
|
// Loop through $source
|
||||||
foreach ($source as $rowData) {
|
foreach ($source as $rowData) {
|
||||||
$currentColumn = $startColumn;
|
$currentColumn = $startColumn;
|
||||||
foreach($rowData as $cellValue) {
|
foreach($rowData as $cellValue) {
|
||||||
if ($cellValue != $nullValue) {
|
if ($strictNullComparison) {
|
||||||
// Set cell value
|
if ($cellValue !== $nullValue) {
|
||||||
$this->getCell($currentColumn . $startRow)->setValue($cellValue);
|
// Set cell value
|
||||||
|
$this->getCell($currentColumn . $startRow)->setValue($cellValue);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($cellValue != $nullValue) {
|
||||||
|
// Set cell value
|
||||||
|
$this->getCell($currentColumn . $startRow)->setValue($cellValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
++$currentColumn;
|
++$currentColumn;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ Fixed in SVN:
|
|||||||
- Feature: (MBaker) Configure PDF Writer margins based on Excel Worksheet Margin Settings value
|
- Feature: (MBaker) Configure PDF Writer margins based on Excel Worksheet Margin Settings value
|
||||||
- Feature: (MBaker) Added Contiguous flag for the CSV Reader, when working with Read Filters
|
- Feature: (MBaker) Added Contiguous flag for the CSV Reader, when working with Read Filters
|
||||||
- Feature: (MBaker) Added getFormattedValue() method for cell object
|
- Feature: (MBaker) Added getFormattedValue() method for cell object
|
||||||
|
- Feature: (MBaker) Added strictNullComparison argument to the worksheet fromArray() method
|
||||||
- Bugfix: (MB) Work item 14143 - NA() doesn't propagate in matrix calc - quick fix in JAMA/Matrix.php
|
- Bugfix: (MB) Work item 14143 - NA() doesn't propagate in matrix calc - quick fix in JAMA/Matrix.php
|
||||||
- Bugfix: (Progi1984) Work item 7895 - Excel5 : Formula : String constant containing double quotation mark
|
- Bugfix: (Progi1984) Work item 7895 - Excel5 : Formula : String constant containing double quotation mark
|
||||||
- Bugfix: (Progi1984) Work item 7895 - Excel5 : Formula : Percent
|
- Bugfix: (Progi1984) Work item 7895 - Excel5 : Formula : Percent
|
||||||
|
Loading…
Reference in New Issue
Block a user