mk-j / PHP_XLSXWriter

Lightweight XLSX Excel Spreadsheet Writer in PHP
MIT License
1.84k stars 665 forks source link

None of you rexample are working #243

Closed placidopollicino closed 5 years ago

placidopollicino commented 5 years ago

I'm sorry to report that I was not able use this class and the examples included are not working.

luca-vercelli commented 5 years ago

Yes, they work. What error did you get? Did you installed "zip" php extension?

placidopollicino commented 5 years ago

If I try the example.php is giving me this error: "Impossibile apri il file 'example.xlslx' perchè ha estensione o formato non valido. Verificare che il file non sia danneggiato e che l'estensione corrisponda al formato del file." after I try to open file. I also tried the first 2 examples in the folder examples and is giving me this error: "Use of undefined constant ENT_XML1 - assumed 'ENT_XML1' in xlsxwriter.class.php on line 760"

luca-vercelli commented 5 years ago

Your last error makes me think that you are using an old version of PHP. ENT_XML1 was introduced in PHP 5.4.0 see https://www.php.net/manual/en/function.htmlentities.php

placidopollicino commented 5 years ago

exactly... for the site I'm using I have 5.3.2.8. I'll try on 5.4 or above... What about the first error?

luca-vercelli commented 5 years ago

I don't know...

placidopollicino commented 5 years ago

even in 5.4 is giving me the same first error...

placidopollicino commented 5 years ago

I'm actually using 5.6.3.0

luca-vercelli commented 5 years ago

No PHP error displayed?

placidopollicino commented 5 years ago

no... none... It prompt me for opening or saving as by design, but after I select open it's trying to open file, it can't and is giving me the error I wrote above...

luca-vercelli commented 5 years ago

maybe the file xlsx is empty?

placidopollicino commented 5 years ago

why is empty? I'm running your example

luca-vercelli commented 5 years ago

I mean, maybe the writer is not working on your machine and the generated XLSX file is 0KB size?

placidopollicino commented 5 years ago

In fact is 0 byte, but even with 0 byte excel should be able to open it if the format is valid

luca-vercelli commented 5 years ago

You are wrong. Excel always gives this error for 0-bytes files. So, your problem is: why is the file empty. I have no idea, you should debug the PHP code.

placidopollicino commented 5 years ago

I'm using your example php file... maybe I was not clear about that... I tried now changing the filename from example.xlsx to example.xls and, even though is giving the error that format is different, is opening the empty file...

placidopollicino commented 5 years ago

on the other end I enable this: "ini_set('display_errors', 1);" in your example.php and I'm getting an excel with this error inside: Warning: readfile(C:\Windows\Temp\xls76A.tmp): failed to open stream: No such file or directory in C:...\xlsxwriter.class.php on line 70

mk-j commented 5 years ago

It sounds like your web application needs write permissions to your temp directory.