Excel Result Version

Jul 8, 2009 at 2:49 AM
Edited Jul 8, 2009 at 3:00 AM

Hi,

I just finish my automatic mysql php to excel using your phpExcel, everybody love it it's realy cool.
My hard work is paid off that's what i thought, but i found one flaw

I use the .xls format ( excel 5 ) for the output since we all use open office here and I know they can read xlsx recently but i still not trust it
the code that i use to save the data to excel:

$this->writer = new PHPExcel_Writer_Excel5($this->excel);
$filename = 'SID:'.$this->shortlistdata[0]['shortlistId'].'_'.time().'.xls';

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment;filename=$filename ");
header("Content-Transfer-Encoding: binary ");
$this->writer->save("php://output");

Than the user will be force to save the excel file in their computer, they can open it also and the format inside is still intact let just say the result is just what they wanted
The problem is it save in Excel5 format so when they reopen the file everything is gone the text still there but all the style broken , the image gone , etc can't be use anymore
The only resolve i have now is after they save to their computer they have to save it again and change the format to Excel 97/2000/XP by then it will have no problem when they reopen it

I understand phpExcel is develop this code for MS Office use ( I just check it, it's work ok in MS Office )  but if you have a way to make it save to Excel 97/2000/XP instead of Excel 5 please tell me

Thank you

Jul 8, 2009 at 2:59 AM

Oh one more things, is there away to save using Excel 2007 to .xls format ?

Developer
Jul 8, 2009 at 3:38 AM

>> The only resolve i have now is after they save to their computer they have to save
>> it again and change the format to Excel 97/2000/XP by then it will have no problem when
>> they reopen it


This has already been fixed:
http://phpexcel.codeplex.com/WorkItem/View.aspx?WorkItemId=10023

Can you try to download latest source code:
http://phpexcel.codeplex.com/SourceControl/ListDownloadableCommits.aspx

   
>> Oh one more things, is there away to save using Excel 2007 to .xls format ?

It is not possible to have a fully featured xls file, for example, you will always be limited to 256 columns in the xls file. This is a limitation in the xls format.

Sep 2, 2009 at 12:00 PM

We are currently using your phpExcel for a new project , your packs are very helpful.

One problem we got here is quite similiar but we still have not got a clear clue .

What we want is to save the excel file in Excel 97/2000/XP so that the xls files can be then processed by other third party's program.

As suggested we downloaded the latest souce code , but still no luck  ,  By reading http://phpexcel.codeplex.com/WorkItem/View.aspx?WorkItemId=10023 , i am a bit confused , how do i manage to get the format right?

Your comments are appreciated .

 

 

 

Developer
Sep 2, 2009 at 12:40 PM

@leoli

>> What we want is to save the excel file in Excel 97/2000/XP so that the xls files can be then processed by other third party's program.

It should suffice to use PHPExcel_Writer_Excel5, example:

$writer = PHPExcel_IOFactory::createWriter($excel, 'Excel5');
$writer->save('write.xls');

>> By reading http://phpexcel.codeplex.com/WorkItem/View.aspx?WorkItemId=10023 , i am a bit confused , how do i manage to get the format right?

That is an old bug in PHPExcel 1.6.7 which you don't have to worry about any more. The bug would make OpenOffice.org think that xls files created by PHPExcel_Writer_Excel5 were of type Excel 5.0 instead of type Excel 97/2000/XP.

Sep 2, 2009 at 8:18 PM

@Koyama

thanks for the information ,Actually we have used the APIs , However ,the file saved as the Excel 5 format other than Microsoft Excel , therefore the third party doesn't accept the excel files or read.

Any idea?

Developer
Sep 2, 2009 at 8:46 PM

>> therefore the third party doesn't accept the excel files or read.

What 3rd party application needs to read the file. Do you have some example of an xls file which the 3rd party application can read. If you send the example of to me in an email, I may be able to figure out what the problem is. (erik at phpexcel dot)

Sep 3, 2009 at 9:45 AM

Hi Koyama.

I can send you the sample Excel docs , but i don't know how to upload the spreadsheets.

Do you have any email address that i can send to ?

We used the API to generate a spreadsheet called example.xls

 

And the required xls format  example is demo.xls ,

 

The two spreadsheets look pretty much the same , however , the third party cannot process the example.xls .But when we use Microsoft Office to open it and then save ,  it can be processed.

 

 

Regards

Leo

 

Developer
Sep 3, 2009 at 2:27 PM

>> Do you have any email address that i can send to ?

You may send example.xls and demo.xls to my email: (erik at phpexcel dot net)