Re: PHPExcel
| From: | Jim Lucas | Date: | Thu, 03 Jul 2008 15:15:11 +0000 |
| Subject: | Re: PHPExcel | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-276251@lists.php.net to get a copy of this message | ||
Dan Shirah wrote:
Jim, I placed it above like you said, but i get the same result. I think I need to do something like the below: if(!empty($query)) { while ($row = ifx_fetch_row($query)) { for ($i = 3; $i <= 50; $i++) { $stat_year = $row['stat_year']; $stat_month = $row['stat_month']; $name = $row['_name']; $case_number = $row['case_number']; echo "This ".$stat_year." ".$stat_month." ".$j_name." ".$case_number."<br />\n"; $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, $stat_year); $objPHPExcel->getActiveSheet()->setCellValue('B' . $i, $stat_month); $objPHPExcel->getActiveSheet()->setCellValue('C' . $i, $name); $objPHPExcel->getActiveSheet()->setCellValue('D' . $i, $case_number); } } } To get it to work I need to set the $i value to the starting cell I want. so, $i = 3 means that setCellValue('A' . $i) means the output will start populating the data in Excel cell A3. If I use the code above I get an output of the exact same record in rows 1-50. Maybe I need to put my query results into an array and use the $i value to select that row of data from the array also?Looking at the example at the following URL http://www.codeplex.com/PHPExcel/Wiki/View.aspx?title=Examples&referringTitle=Home You can see that infact they do give the column/row combo in the setCellValue() method. -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare