简体   繁体   English

在php中创建Excel文件的问题

[英]Issues with creating excel files in php

I'm using a library called "ExcelWriterXML" in PHP to create excel files. 我在PHP中使用一个名为“ ExcelWriterXML”的库来创建Excel文件。

They are created in format .xls and I myself doesn't have any problem opening them. 它们以.xls格式创建,我自己打开它们没有任何问题。

Unfortunately, my customers do. 不幸的是,我的顾客这样做。 When they try to open the file they get an error saying that the file is corrupt. 当他们尝试打开文件时,收到错误消息,指出文件已损坏。

I have tried to change the code so it creates a file with .xlsx format instead, but then the file doesn't work for me. 我试图更改代码,因此它改为创建.xlsx格式的文件,但是该文件对我不起作用。 (I'm supposed to have the latest excel reader so shouldn't be a problem with my software) I can't seem to understand what the problem is, so now I turn to you! (我应该拥有最新的excel阅读器,所以我的软件应该不会有问题)我似乎无法理解问题所在,所以现在转向您!

Any ideas what may be causing the problem? 有什么想法可能导致问题吗?

Thank you for all the help! 感谢您的所有帮助!

The problem is that it uses column index starting from zero. 问题是它使用从零开始的列索引。 Change the line in excelWriterXML_Sheet.php line 335: 更改excelWriterXML_Sheet.php行335中的行:

$column

to

 $column + 1

It should solve the problem. 它应该解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM