Login   Register  
PHP Classes
elePHPant
Icontem

bad xls file

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      MS-Excel Stream Handler  >  All threads  >  bad xls file  >  (Un) Subscribe thread alerts  
Subject:bad xls file
Summary:the code generates a .xls file, but content is in a single cell
Messages:31
Author:Jim A
Date:2005-01-21 03:07:09
Update:2009-10-09 05:13:59
 
  1 - 10   11 - 20   21 - 30   31 - 31  

  21. Re: bad xls file   Reply  
Picture of Hugo Dias
Hugo Dias
2008-12-06 01:17:54 - In reply to message 20 from kyungjoon min
Hi there

can anyone explain to me where the file gets saved? i mean the location...

i've used:

$export_file = 'xlsfile://tmp/'.strftime('%Y%m%d%H%M%S').'.xls';

but im not able to find the file in the server...


im using a shared host in linux...

plus... im getting a lot of garbage in the excel...maybe the enconding?

plz help

  22. Re: bad xls file   Reply  
Picture of dnvnb
dnvnb
2009-02-17 05:49:13 - In reply to message 21 from Hugo Dias
Possible Solution:

I aslo got the error message:
fopen(xlsfile://tmp/name_list.xls) [function.fopen]: failed to open stream: "xlsStream::stream_open"

This was the solution for me...

On line 74 in excel.php (2nd line of "function stream_open")
I removed the opening forward slash from the xlsfilename:

$this->xlsfilename = '/' . $url['host'] . $url['path'];
change to
$this->xlsfilename = $url['host'] . $url['path'];


- xls file does not have to exist yet (it can be created on run time)
- The directory must exist & can be a relative directory



Now I just get a Notice: Undefined variable: size in E:\My Projects\Web\Pages\pers\name list.tool\excel.php on line 163, but it still works.

  23. Re: bad xls file   Reply  
Picture of dnvnb
dnvnb
2009-02-17 06:00:46 - In reply to message 22 from dnvnb
A Suggestion to Hugo Dias.
"plus... im getting a lot of garbage in the excel...maybe the enconding?"

When I added the code for the "example_download.php", I got the same problem you did. Or a similar one anyway.

If you use the code to opening or downloading the xls file right away, the file is first read into the browser; then what ever has been read into the browser will be sent with the xls file..

Try to do the download process in a different php page entirely... This will help to eliminate any error messages or other junk text which is produced in in export process from being thrown into the xls download file.

  24. Re: bad xls file   Reply  
Picture of dnvnb
dnvnb
2009-02-17 06:57:19 - In reply to message 23 from dnvnb
forget the last suggestion:

if php is set to display notice messages, you'll get two notices:
one each for $size, and $data not being defined.

in "excel.php" I added:
$data=""
to the top of the function stream_read
and
$size=""
to the top of the function xls_stream_write

After that I no longer had junk added in my download xls.

  25. xlsfile   Reply  
Picture of alessandro porro
alessandro porro
2009-03-26 18:40:39 - In reply to message 24 from dnvnb
i find this solution (hostin linux)
$excelfile = "xlsfile:/".$_SERVER["DOCUMENT_ROOT"]."/".$filename;

  26. Re: bad xls file   Reply  
Picture of Jay Charles
Jay Charles
2009-04-28 22:16:11 - In reply to message 1 from Jim A
The problem is in the value of $path in the stream_open function. Windows chokes on the xlsfile:// prefix, so stripping it out of the path seems to fix the problem

At the top of the function (line 73), add something like this

$parts = explode("//", $path);
$path = $parts[1];
$url = parse_url($path);

Now the path is the true windows path, and the class works. If you wanted to be complete about it, you can do some OS testing to make sure the program is running on windows before dicking with the path

BTW... great class Ignatius... saved me a world of time.

  27. Re: bad xls file   Reply  
Picture of Julien
Julien
2009-05-23 18:39:11 - In reply to message 1 from Jim A
completely useless as a script run from a local computer...

  28. Re: bad xls file   Reply  
Picture of nagarjuna
nagarjuna
2009-09-23 10:50:01 - In reply to message 2 from Ignatius Teo
I’m getting the following when I open the excel file:
i am using PHP Version 4.3.9

System Linux server
This is only happening in linux server. Any body Please help me

a:3:{i:0;a:5:{s:12:”Sales Person”;s:11:”Sam Jackson”;s:2:”Q1″;s:5:”$3255″;s:2:”Q2″;s:5:”$3167″;s:2:”Q3″;i:3245;s:2:”Q4″;i:3943;}i:1;a:5:{s:12:”Sales Person”;s:9:”Jim Brown”;s:2:”Q1″;s:5:”$2580″;s:2:”Q2″;s:5:”$2677″;s:2:”Q3″;i:3225;s:2:”Q4″;i:3410;}i:2;a:5:{s:12:”Sales Person”;s:12:”John Hancock”;s:2:”Q1″;s:5:”$9367″;s:2:”Q2″;s:5:”$9875″;s:2:”Q3″;i:9544;s:2:”Q4″;i:10255;}}

The below code i am using

require_once “excel.php”;
$export_file = “example”;

$appPath = preg_replace(”/([A-Za-z]:\/)/”, “xlsfile://”, eregi_replace(”\\\\”, ‘/’, dirname(__FILE__)),1);

$gen_file = $appPath.”/excel/$export_file.xls”;

// typically this will be generated/read from a database table
$myresult = array(
array(”Sales Person” => “Sam Jackson”, “Q1″ => “$3255″, “Q2″ => “$3167″, “Q3″ => 3245, “Q4″ => 3943),
array(”Sales Person” => “Jim Brown”, “Q1″ => “$2580″, “Q2″ => “$2677″, “Q3″ => 3225, “Q4″ => 3410),
array(”Sales Person” => “John Hancock”, “Q1″ => “$9367″, “Q2″ => “$9875″, “Q3″ => 9544, “Q4″ => 10255),
);

$fp = fopen($gen_file, “wb”);
fwrite($fp, serialize($myresult));

Any body Please help me

Thanks
Nagarjuna

  29. Re: bad xls file   Reply  
Picture of greatknowledge
greatknowledge
2009-10-09 04:04:34 - In reply to message 11 from Ignatius Teo
hey there... I am very amazed..

xlsfile://tmp/example.xls

It somehow did not translate to any directory in my server, where do I find the physical file example.xls ?

  30. Re: bad xls file   Reply  
Picture of greatknowledge
greatknowledge
2009-10-09 05:11:17 - In reply to message 29 from greatknowledge
I still cant figure out where the file is stored on my virtual host server..

 
  1 - 10   11 - 20   21 - 30   31 - 31