01.
<?
02.
03.
$strPath
=
realpath
(
basename
(
getenv
(
$_SERVER
[
"SCRIPT_NAME"
])));
04.
$OpenFile
=
"MyXls/MyExcelDB.xls"
;
05.
06.
$xlApp
=
new
COM(
"Excel.Application"
);
07.
$xlBook
=
$xlApp
->Workbooks->Open(
$strPath
.
"/"
.
$OpenFile
);
08.
09.
10.
$xlSheet1
=
$xlBook
->Worksheets(1);
11.
?>
12.
Sheet 1
13.
<table width=
"420"
border=
"1"
>
14.
<?
15.
$i
=1;
16.
while
(
$xlSheet1
->Cells->Item(
$i
,1) !=
""
)
17.
{
18.
?>
19.
<tr>
20.
<td><?=
$xlSheet1
->Cells->Item(
$i
,1);?></td>
21.
<td><?=
$xlSheet1
->Cells->Item(
$i
,2);?></td>
22.
<td><?=
$xlSheet1
->Cells->Item(
$i
,3);?></td>
23.
<td><?=
$xlSheet1
->Cells->Item(
$i
,4);?></td>
24.
<td><?=
$xlSheet1
->Cells->Item(
$i
,5);?></td>
25.
<td><?=
$xlSheet1
->Cells->Item(
$i
,6);?></td>
26.
</tr>
27.
<?
28.
$i
=
$i
+ 1;
29.
}
30.
?>
31.
</table>
32.
<?
33.
$xlSheet2
=
$xlBook
->Worksheets(2);
34.
?>
35.
Sheet 2
36.
<table width=
"420"
border=
"1"
>
37.
<?
38.
$i
=1;
39.
while
(
$xlSheet2
->Cells->Item(
$i
,1) !=
""
)
40.
{
41.
?>
42.
<tr>
43.
<td><?=
$xlSheet2
->Cells->Item(
$i
,1);?></td>
44.
<td><?=
$xlSheet2
->Cells->Item(
$i
,2);?></td>
45.
<td><?=
$xlSheet2
->Cells->Item(
$i
,3);?></td>
46.
<td><?=
$xlSheet2
->Cells->Item(
$i
,4);?></td>
47.
<td><?=
$xlSheet2
->Cells->Item(
$i
,5);?></td>
48.
<td><?=
$xlSheet2
->Cells->Item(
$i
,6);?></td>
49.
</tr>
50.
<?
51.
$i
=
$i
+ 1;
52.
}
53.
?>
54.
</table>
55.
<?
56.
57.
$xlApp
->Application->Quit();
58.
$xlApp
= null;
59.
$xlBook
= null;
60.
$xlSheet1
= null;
61.
?>