excel|数据一个打开Excel AP制作EXCEL数据的简单范例。
<? $excel = new COM("Excel.Application") or die("Unable to instanciate Excel");
$excel->Visible = 0;
$book=$excel->Workbooks->Add; $book->Title="excel范例"; $book->Subject="这是Excel范例程序制作的Excel档";
$sheet=$book->Worksheets("Sheet1"); $Range=$sheet->Range("A1:C10"); For($i=1;$i<=10;$i++): For($j=1;$j<=3;$j++): $cell=$Range->Cells($j,$i); $cell->value=Chr($i+64).$j; ## 塞入A1:C10的值 EndFor; EndFor;
$book->SaveAs("c:\excel.xls"); ## 存档
$excel->Quit(); $excel->Release(); $excel = null;
?>
|