Example
Microsoft Excel
require_once 'excel_reader2.php';
$xls = new Spreadsheet_Excel_Reader("example.xls");
echo '';for ($row=1;$row<=$xls->rowcount();$row++) {
echo '
';for ($col=1;$col<=$xls->colcount();$col++) {
echo '
';}
echo '
';}
echo '
' . $xls->val($row,$col) . ' |
';
?>
HTML Output
Usage
$data = new Spreadsheet_Excel_Reader("test.xls");
Retrieve formatted value of cell (first or only sheet):
$data->val($row,$col)
Or using column names:
$data->val(10,'AZ')
From a sheet other than the first:
$data->val($row,$col,$sheet_index)
Retrieve cell info:
$data->type($row,$col);
$data->raw($row,$col);
$data->format($row,$col);
$data->formatIndex($row,$col);
Get sheet size:
$data->rowcount();
$data->colcount();
$data->sheets[0]['cells'][$i][$j] - data from $i-row $j-column
$data->sheets[0]['numRows'] - count rows
$data->sheets[0]['numCols'] - count columns
$data->sheets[0]['cellsInfo'][$i][$j] - extended info about cell
$data->sheets[0]['cellsInfo'][$i][$j]['type'] = "date" | "number" | "unknown"
$data->sheets[0]['cellsInfo'][$i][$j]['raw'] = value if cell without format
$data->sheets[0]['cellsInfo'][$i][$j]['format'] = Excel-style Format string of cell
$data->sheets[0]['cellsInfo'][$i][$j]['formatIndex'] = The internal Excel index of format
$data->sheets[0]['cellsInfo'][$i][$j]['colspan']
$data->sheets[0]['cellsInfo'][$i][$j]['rowspan']
No comments:
Post a Comment
Thank you for your Comment....