Http://sourceforge.net/projects/phpexcelreader/
I. Overview
Php-excelreader is a PHP class that reads the content of an Excel XSL file.
Its download URL: http://sourceforge.net/projects/phpexcelreader/
File Name: phpexcelreader.zip
Contains two required files: oleread. INC and reader. php. Other files are an application example and a self-report file.
Ii. File Usage
First, include the reader file: require_once "Reader. php ";
Create an instance: $ xl_reader = new spreadsheet_excel_reader ();
Read Excel File Information: $ xl_reader-> Read ("filename.xls ");
It stores all identifiable data in the exported Excel file in one object. Data is stored in two arrays. Currently, no methods/functions are provided to access the data. You can use the array name as follows.
The sheets array contains a large amount of data read into the object. It stores all identifiable data in the exported Excel file in a two-dimensional array $ xl_reader-> sheets [x] [Y]. X is the sequence number of the table in the document, and Y is one of the following parameters:
L numrows -- int -- number of rows in the table
For example: $ rows = $ xl_reader-> sheets [0] ['numrows ']
L numcols -- int -- number of columns in the table
Example: $ Cols = $ xl_reader-> sheets [0] ['numcols']
L cells -- array -- actual table content. Is a 2-dimensional array in the format of [row] [column]
For example: $ cell_2_4 = $ xl_reader-> sheets [0] ['cells '] [2] [4] // Row 2, data in column 4
L cellsinfo -- array -- information of different data types in the table. Each table contains the original data and type of the table. This array contains two parts: raw -- original table data; type -- data type.
Note: Only non-text data information is displayed.
Example: $ cell_info = $ xl_reader [0] ['cellsinfo'] [2] [4]
$ Cell_info ['Raw'] is the raw data from the cell
$ Cell_info ['type'] is the data type
$ Xl_reader-> sheets array example:
The boundsheets array contains other information about the object. The array is indexed by the workbook. The second index is named $ xl_reader-> boundsheets [I] ['name']. The table name of the I table is returned.
Example: $ sheetname = $ xl_reader-> boundsheets [0] ['name']; // name of the first sheet
$ Xl_reader-> boundsheets array example:
Array
(
[0] => Array
(
[Name] => sheet1
[Offset] = & gt; 3054
)
)
Php-excelreader supports only biff7 and biff8 files. Including excel95 to excel2003. but not including excel5.0 and earlier versions. in fact, the biff8x used by Excel XP and Excel 2003 is an extension of the biff8 format. all added features may not be used by PHP-excelreader. lock support. Otherwise, it can only run in an Excel XP/2003 file.
If:Fatal error: require_once () [function. require]: Failed opening required' spreadsheet/EXCEL/Reader/oleread. PHP '(include_path = '.; \ XAMPP \ PHP \ pear ') in xxxx
The spreadsheet/EXCEL/Reader/oleread. php file is missing. But this file does not exist! Find the oleread. inc file in the Excel directory, and replace spreadsheet/EXCEL/Reader/oleread. php with oleread. Inc!
That is
Require_once 'spreadsheet/EXCEL/Reader/oleread. php ';
Change
Require_once 'oleread. inc ';
You can.
In addition, in example. php, You need to modify
$ Data-> setoutputencoding ('cp1251 ');
Is
$ Data-> setoutputencoding ('cp936 ');
Otherwise, there will be problems with Chinese characters.
If you use traditional Chinese, you can change it to cp950 or cp932 in Japanese. For details, refer to the codePage description.
Also, the built-in jxlrwtest.xls may be faulty. You need to modify the following in example. php:
$ Data-> Read ('jxlrwtest.xls ');