From 4faf3111d133d8d1ebcd422d339fd43261831fa5 Mon Sep 17 00:00:00 2001 From: Mika Tuupola Date: Fri, 11 Apr 2003 07:45:42 +0000 Subject: [PATCH] * added writeRow() and writeCol() methods git-svn-id: https://svn.php.net/repository/pear/packages/Spreadsheet_Excel_Writer/trunk@123123 c90b9560-bf6c-de11-be94-00142212c4b1 --- Writer/Worksheet.php | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/Writer/Worksheet.php b/Writer/Worksheet.php index b4e1cba..8e336c3 100644 --- a/Writer/Worksheet.php +++ b/Writer/Worksheet.php @@ -1046,6 +1046,49 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr } } + /** + * Write an array of values as a row + * + * @access public + * @param + * @return + */ + + function writeRow($row, $col, $val, $format=0) + { + if (is_array($val)) { + foreach($val as $v) { + if (is_array($v)) { + $this->writeCol($row, $col, $v, $format); + } else { + $this->write($row, $col, $v, $format); + } + $col++; + } + } else { + $retval = new PEAR_Error('$val needs to be an array'); + } + } + + /** + * Write an array of values as a column + * + * @access public + * @param + * @return + */ + + function writeCol($row, $col, $val, $format=0) + { + if (is_array($val)) { + foreach($val as $v) { + $this->write($row, $col, $v, $format); + $row++; + } + } else { + $retval = new PEAR_Error('$val needs to be an array'); + } + } /** * Returns an index to the XF record in the workbook