Use php to generate an excel file 1. use php to generate an excel file to describe its principles:
The document directory components in excel2007 are:
3. the code is as follows:
Open ('. /01.xlsx ', ZIPARCHIVE: CREATE); // 3. create an excel file (file directory and xml file) $ ex-> addFromString ('[Content_Types]. XML ',"
"); $ Ex-> addFromString ('_ rels/. rels ',"
"); $ Ex-> addFromString ('docprops/app. XML ',"
"); $ Ex-> addFromString ('docprops/core. XML ',"
"); $ Ex-> addFromString ('docprops/M. XML ',"
"); $ Ex-> addFromString ('XL/_ rels/workbork. xml. rels ',"
"); $ Ex-> addFromString ('XL/theme/theme1.xml ',"
"); $ Ex-> addFromString ('XL/theme/worksheets/sheet1.xml ',"
"); $ Ex-> addFromString ('XL/theme/worksheets/sheet2.xml ',"
"); $ Ex-> addFromString ('XL/theme/worksheets/sheet3.xml ',"
"); $ Ex-> addFromString ('XL/styles. XML ',"
"); $ Ex-> addFromString ('XL/workbook. XML ',"
");?>
After php is executed, an excel2007 file is generated. after renaming and compressing the file, you can see the generated file. However, the excel file of this version is incomplete and cannot be used, you also need to use an excel package to write a large amount of data. This is only an understanding of ecxcel file generation.