PHP电子表格编写器将变量写入excel

时间:2013-05-21 18:03:14

标签: php excel file-io

我正在尝试将数组中的变量写入excel,但我无法在某些情况下编写

代码如下

$workbook =new Spreadsheet_Excel_Writer();
$workbook->send("response.xls");
$row=1;
$col=1;
$workbook->setVersion(8);
$worksheet =& $workbook->addWorksheet('My sheet ');
$Allquestions = $questions->getQuestions();
foreach ($Allquestions as $qkey=>$qval) {
    foreach ($studentResponses as $rval){
        $astresp= $rval->getResponse($qkey);
        //$worksheet->write($row,$col,'hiii');
        $worksheet->write($row, $col, $astresp);
        $col++;
    }
    $row++;
    $col=1;
}
$workbook->close();
更改为'hihi'的$ astresp在excel中打印hihi但是当它仍然是$ astresp时,它无法打开excel。

0 个答案:

没有答案