PHP import and export of Excel file methods

time:13-03-24 forum:PHP tools and code
  Reloaded from http://www.jz123.cn/text/0563049.html

1, PHP export Excel file

1: first recommends the uncoquettish PHPExcel, the official website:
2, Spreadsheet_Excel_Writer class

download address with pear:
> > Iter

dependency on OLE, download address: http://pear.php.net/package/OLE

it needs to be noted that the exported Excel file format is older, and the modified save will be prompted to be converted into an updated format. But it can be formatted, very powerful.

3: uses Smarty to generate XML or HTML files that conform to the Excel specification

support format, a very perfect export solution. However, the essence of the XML file is, if it is used to import, it needs additional processing.

details to see the post of rardge Warrior: http://bbs.chinaunix.net/viewthread.php? Tid=745757

it is necessary to note that if the number of exported forms is uncertain, it is best to delete "ss:ExpandedColumnCount=" 5 "ss:ExpandedRowCount =" 21 "" in the template.

4, using the pack function to print out the analog Excel form of sentence symbols, this is closer to the Excel standard format, office2003 modified to save, and will not play a hint, recommend this method. The shortcoming is that there is no format.

5,

tab "t" by using a tabs, a row character, the user divides the columns in the same line, and the newline "TN" can open the next line.

6, using com

if your PHP can open the COM module, you can use it to export the Excel file

two, PHP import excel file
1. to read / > convert into text format, and then analyze the file again, There is no difference between the analysis of the text and the PHP.

advantages: cross platform, high efficiency, can read and write.

disadvantages: only.Csv files can be used directly. If.Xls binary files are often accepted, manual transformation is needed, and automation can not be done. A file has only one SHEET.

PHP has its own analytical.Csv function: fgetcsv

2. ODBC link data source

advantages: support multiple formats, CVs, xls, and so on. Support reading and writing, using standard SQL language, and SQLSERVER, MYSQL database almost exactly the same.

drawback: value supports Windows Server

3. PHP custom class

advantages: cross platform. Some classes support write operations. Support.Xls binary file

commonly used classes have phpExcelReader, PHPExcel. The latter supports reading and writing, but requires more than php5.2 versions.

phpExcelReader is specially used to read files. Returns an array containing all the contents of the table.

prev: next:The first amateur baseball team in Ji'na...
post comment
Notice



approved   The latest regulations on maternity ...   Mother resigned as a crippled daught...   She lost her legs but still challeng...   A total of 12 years of investigation...   Ding Dawei, a foreign member of the ...
rand   PHP random number generation and use...   Talk about 10 MySQL mistakes that PH...   10 MySQL errors that PHP developers ...   Eliminate 3 Chinese characters from ...   Importing large databases to virtual...
ads

other

Because all the contents of this site are reproduced from other media, the intention is to provide free services to the public, but it does not mean that this site agrees with its views, and can not be responsible for the authenticity of its verification, such as the copyright unit or individual of the manuscript does not want to publish on this site, please Contact me, I will immediately remove it, thank you. Contact: atseashawk@163.com