1

我在 centos 7 下的 php 5 中使用 xlsxwriter 这是一个生成 xlsx 文件的简单脚本:

<?php
require_once('xlsxwriter.class.php');
$writer = new XLSXWriter();
$writer->writeSheetRow('test', array('test'), ['border'=>'bottom']);
$writer->writeToFile('/var/www/html/test.xlsx');
?>

当我下载文件时,Excel 2007 会发出警告:

Excel found unreadable content in 'test.xlsx'. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes.

如果我删除“,['border'=>'bottom']”,它会正确打开。

我尝试使用 OpenOffice (LibreOffice Calc) 打开它,它运行良好。如果我用 OpenOffice 保存它,Excel 会正确打开它。

谁能告诉我我做错了什么?

4

0 回答 0