forked from pherrymason/simplexlsx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimplexlsx.example2.php
More file actions
42 lines (30 loc) · 806 Bytes
/
simplexlsx.example2.php
File metadata and controls
42 lines (30 loc) · 806 Bytes
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
<?php
include 'simplexlsx.class.php';
$xlsx = new SimpleXLSX('countries_and_population.xlsx');
echo '<table cellpadding="10">
<tr><td valign="top">';
// output worsheet 1
list($num_cols, $num_rows) = $xlsx->dimension();
echo '<h1>Sheet 1</h1>';
echo '<table>';
foreach( $xlsx->rows() as $r ) {
echo '<tr>';
for( $i=0; $i < $num_cols; $i++ )
echo '<td>'.( (!empty($r[$i])) ? $r[$i] : ' ' ).'</td>';
echo '</tr>';
}
echo '</table>';
echo '</td><td valign="top">';
// output worsheet 2
list($num_cols, $num_rows) = $xlsx->dimension(2);
echo '<h1>Sheet 2</h1>';
echo '<table>';
foreach( $xlsx->rows(2) as $r ) {
echo '<tr>';
for( $i=0; $i < $num_cols; $i++ )
echo '<td>'.( (!empty($r[$i])) ? $r[$i] : ' ' ).'</td>';
echo '</tr>';
}
echo '</table>';
echo '</td></tr></table>';
?>