如何在PHP中使用Spreadsheet_Excel_Writer()在Excel单元格中输出超过255个字符?

时间:2009-05-11 21:30:30

标签: php export-to-excel

我正在尝试在Excel电子表格中输出几段文本,但是现在文本被截断以仅显示255个字符。代码非常简单:

$xls =& new Spreadsheet_Excel_Writer();
$sheet =& $xls->addWorksheet($name);

foreach ($rec as $field) {
    $rec = ($rec['data'] ? $rec['data'] : $rec);
    $sheet->write($row, $col++, $field);
}

我能做些什么来获取所有文字,而不仅仅是255个字符?

1 个答案:

答案 0 :(得分:6)

来自a note in the documentation

$workbook->setVersion(8); // Use Excel97/2000 Format
$worksheet->writeString(0, 0, $str);