| View previous topic :: View next topic |
| Author |
Message |
venkatadapa

Joined: 12 May 2008 Posts: 280
|
Posted: Fri Jun 06, 2008 9:36 am Post subject: How to Create Excel .xls file |
|
|
Hi friends,
I have to create a Excel file using php, if anybody knows code in php for creating word document please send me
thanks in advance |
|
| Back to top |
|
 |
samir
Joined: 12 Nov 2007 Posts: 260
|
Posted: Fri Jun 06, 2008 9:57 am Post subject: |
|
|
Hi venkat,
You can create excel files using the following code
<?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("C:\htdocs\excel123.xls");
//Quit MS Excel
$wkb->Close(false);
$excel->Workbooks->Close();
$excel->Quit();
unset($sheet);
unset($excel);
?> |
|
| Back to top |
|
 |
|