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

时间:2020-12-09 22:19:17

I am trying to output a few paragraphs of text in an Excel spreadsheet, but right now the text is truncated to display only 255 characters. The code is pretty straightforward:

我试图在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);
}

Is there anything I can do to get all of the text, not just the 255 chars?

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

1 个解决方案

#1


From a note in the documentation:

从文档中的注释:

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

#1


From a note in the documentation:

从文档中的注释:

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