-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.php
57 lines (55 loc) · 1.24 KB
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<html>
<head>
<style type="text/css">
table {
border-collapse: collapse;
}
td {
border: 1px solid black;
padding: 0 0.5em;
}
</style>
</head>
<body>
<?php
include 'reader.php';
$excel = new Spreadsheet_Excel_Reader();
?>
Sheet 1:<br/><br/>
<table>
<?php
$excel->read('sample.xls');
$x=1;
while($x<=$excel->sheets[0]['numRows']) {
echo "\t<tr>\n";
$y=1;
while($y<=$excel->sheets[0]['numCols']) {
$cell = isset($excel->sheets[0]['cells'][$x][$y]) ? $excel->sheets[0]['cells'][$x][$y] : '';
echo "\t\t<td>$cell</td>\n";
$y++;
}
echo "\t</tr>\n";
$x++;
}
?>
</table><br/>
Sheet 2:<br/><br/>
<table>
<?php
$excel->read('sample.xls');
$x=1;
while($x<=$excel->sheets[1]['numRows']) {
echo "\t<tr>\n";
$y=1;
while($y<=$excel->sheets[1]['numCols']) {
$cell = isset($excel->sheets[1]['cells'][$x][$y]) ? $excel->sheets[1]['cells'][$x][$y] : '';
echo "\t\t<td>$cell</td>\n";
$y++;
}
echo "\t</tr>\n";
$x++;
}
?>
</table>
</body>
</html>