Bugfix: Work item 15129 - Worksheet fromArray() only working with 2-D arrays

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@67182 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2011-01-21 10:47:20 +00:00
parent dd4f5252ea
commit 5a2830c499
2 changed files with 6 additions and 0 deletions

View File

@ -2105,6 +2105,11 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
*/
public function fromArray($source = null, $nullValue = null, $startCell = 'A1', $strictNullComparison = false) {
if (is_array($source)) {
// Convert a 1-D array to 2-D (for ease of looping)
if (!is_array(end($source))) {
$source = array($source);
}
// start coordinate
list ($startColumn, $startRow) = PHPExcel_Cell::coordinateFromString($startCell);

View File

@ -45,6 +45,7 @@ Fixed in SVN:
- Bugfix: (MBaker) Minor patchfix for Excel2003XML Reader when XML is defined with a charset attribute
- Bugfix: (MBaker) Work item 15089 - PHPExcel_Worksheet->toArray() index problem
- Bugfix: (MBaker) Work item 15094 - Merge cells 'un-merge' when using an existing spreadsheet
- Bugfix: (MBaker) Work item 15129 - Worksheet fromArray() only working with 2-D arrays
- General: (MBaker) Improved performance (speed), for building the Shared Strings table in the Excel2007 Writer.