Php can be used to generate excel files through php .?? Teaman translation ---------------------------- ExcelFunctions -------------------------- save the following code as excel. php, include it in the page, and then call 1. CallxlsBOF ()? Php skills for generating excel dongdongdong_php
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.
???
// ----- 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:
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 (9999 );?? // Write a number B1
XlsEOF (); // close the stream
?>
Article: Western Digital-professional domain name registration and virtual hosting services
Http://www.west263.com?
The above information is an integral part of the text. if you want to reprint this article, please keep the above information. thank you!Php skills for generating excel dongdongdong_php