<?php
$excel = new COM("excel.application");
//Keep Excel invisible
$excel->Visible = 0;
//Create a new workbook
$wkb = $excel->Workbooks->Add();
$sheet = $wkb->Worksheets(1);
//This code adds the text 'Test' on row 2, column 4
$sheet->activate;
$cell = $sheet->Cells(2,4);
$cell->Activate;
$cell->value = 'Test';
//Save the file just like the Word file above
$wkb->SaveAs("excel123.xls");
//Quit MS Excel
$wkb->Close(false);
$excel->Workbooks->Close();
$excel->Quit();
unset($sheet);
unset($excel);
?>
No comments:
Post a Comment