From:  pear-qa@lists.php.net ("sagar.arora@brucode.com")
Date:  15 Mar 2017 00:02:45 Hong Kong Time
Newsgroup:  news.php.net/php.pear.bugs
Subject:  

[PEAR-BUG] Req #8408 [Com]: Problem with foreach loop

NNTP-Posting-Host:  null

Edit report at https://pear.php.net/bugs/bug.php?id=8408&edit=1

 ID:               8408
 Comment by:       sagar dot arora at brucode dot com
 Reported By:      soli at freemail dot it
 Summary:          Problem with foreach loop
 Status:           No Feedback
 Type:             Feature/Change Request
 Package:          Spreadsheet_Excel_Writer
 Operating System: Win2003 EE
 Package Version:  0.9.0
 PHP Version:      5.0.2
 Roadmap Versions: 
 New Comment:

Hi,

I am also facing the same problem. File crashed when trying to create
multiple spreadsheets each having different values.

Please provide some solutions.


Previous Comments:
------------------------------------------------------------------------

[2009-11-29 02:40:20] cschmitz

-Status: Feedback
+Status: No Feedback
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

------------------------------------------------------------------------

[2006-09-18 06:54:50] pear dot php dot net at chsc dot dk

According to the documentation, $worksheet->addWorksheet() may return a
PEAR_Error. You should check the return value using
PEAR::isError($worksheet) before calling $worksheet->writeString(). The
PEAR_Error object contains an error message explaining what went wrong.

------------------------------------------------------------------------

[2006-08-10 08:04:16] soli at freemail dot it

Description:
------------
I'm trying to write to multiple worksheet.
First I read a text file, for each line I create a worksheet (since now
no problems) than I try to write values into these worksheets (this does
not work!).

Test script:
---------------
$readfile=file("file.txt");
require_once 'Spreadsheet/Excel/Writer.php';
$workbook = new Spreadsheet_Excel_Writer('test.xls');

foreach($readfile as $r){
 $r=trim($r);
 $worksheet =& $workbook->addWorksheet($l); //This works
 $worksheet->writeString(0, 0, 'Somevalue'); //This does not work
 $l=""; 
}
$workbook->close();


Expected result:
----------------
I expect an excel file with multiple worksheet populated with values

Actual result:
--------------
This is the error I find:
PHP Fatal error:  Call to undefined method PEAR_Error::writeString() in
D:\phpwebsite\excel.php on line 7

------------------------------------------------------------------------


-- 
Edit this bug report at https://pear.php.net/bugs/bug.php?id=8408&edit=1