phpspreadsheet - 无法在 Phpspreadsheet 中设置单元格值
问题描述
因此,这与票据phpspreadsheet setCellValue is not writing非常相似,但是我根本无法在 Phpspreadsheet 中设置 XLSX 或 ODS 文件的单元格值(根据我的经验,ODS 文件可能会使资源管理器崩溃)。我有以下功能,它在 Phpexcel 中运行良好,并且仍然适用于 XLS,但正如我所说 - 不是 XLSX 或 ODS。我尝试了 2 种设置方法 - 都具有相同的结果。我没有收到任何错误,但浏览器只是以“无法访问此站点”退出。我正在运行 LAMP 和 Ubuntu。为什么这不起作用?
public function setCell($ref,$value){
//$this->active_sheet->setCellValue($ref,$value);
$this->active_sheet->fromArray(array($value),null,$ref);
}
解决方案
因此,经过大量调查 - 此问题与此处报告的错误相同:https ://github.com/PHPOffice/PHPExcel/issues/846 。事实证明,$writer->setPreCalculateFormulas(false);
在使用 save() 输出之前运行修复了这个问题。
推荐阅读
- javascript - 如何使具有交叉轴溢出的flexbox具有相同的高度?
- xcode - 在 xcode 11.5 中构建颤振项目时找不到 grpc/grpc.h 文件错误
- c#-4.0 - 如何允许类仅从两个接口之一继承
- cron - 用氮气生成随机壁纸的简单 cron 作业
- apache-spark - Spark PySpark 以一列值作为键输出 JSON
- flutter - 带有继承类的颤振飞镖JsonSerializable
- python - 在 pandas Python 中读取大表的有效方法是什么?
- stata - 你能划分两个表的条目吗?
- laravel - 如何添加“或”条件来调用 Laravel 路由上的中间件?
- python - Pandas 从 12 个 excel 文档导入 - FileNotFoundError: [Errno 2] No such file or directory: 'x'