You can use PHP to generate an EXCEL file. teaman Translation
----------------------------
Excel Functions
----------------------------
Save the following code as excel. php and include it in the page.
Then call
1. Call xlsBOF ()
2. Write some content to xlswritenunber () or xlswritelabel.
3. Call xlsEOF ()
You can also use the fwrite function to directly write data to the server, instead of simply displaying data in the browser with echo.
<? Php
// ----- Begin of function library -----
// Excel begin of file header
Function xlsBOF (){
Echo pack ("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0 );
Return;
}
// Excel end of file footer
Function xlsEOF (){
Echo pack ("ss", 0x0A, 0x00 );
Return;
}
// Function to write a Number (double) into Row, Col
Function xlsWriteNumber ($ Row, $ Col, $ Value ){
Echo pack ("sssss", 0x203, 14, $ Row, $ Col, 0x0 );
Echo pack ("d", $ Value );
Return;
}
// Function to write a label (text) into Row, Col
Function xlsWriteLabel ($ Row, $ Col, $ Value ){
$ L = strlen ($ Value );
Echo pack ("ssssss", 0x204, 8 + $ L, $ Row, $ Col, 0x0, $ L );
Echo $ Value;
Return;
}
// ----- End of function library -----
?>
//
// To display the contents directly in a MIME compatible browser
// Add the following lines on TOP of your PHP file:
<? Php
Header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT ");
Header ("Last-Modified:". gmdate ("D, d m yh: I: s"). "GMT ");
Header ("Cache-Control: no-cache, must-revalidate ");
Header ("Pragma: no-cache ");
Header ('content-type: application/x-msexcel ');
Header ("Content-Disposition: attachment; filename=EmplList.xls ");
Header ("Content-Description: PHP/INTERBASE Generated Data ");
//
// The next lines demonstrate the generation of the Excel stream
//
XlsBOF (); // begin Excel stream
XlsWriteLabel (0, 0, "This is a label"); // write a label in A1, use for dates too
XlsWriteNumber (0, 1, 9999); // write a number B1
XlsEOF (); // close the stream
?>