Reputation: 1472
$PHPExcel->getDefaultStyle()->getFont()->setName('Arial')
->setSize(10);
$PHPExcel->setActiveSheetIndex(0)
->setCellValue('A1', 'Linto')
->setCellValue('B1', 'Cheeran')
->setCellValue('A2', 'Sandhya');
$PHPExcel->getActiveSheet()->setCellValue('A5', 'date')
->setCellValue('B5', '31-12-2010');
if there are more cells, how control them in phpexcel ?
->setCellValue('A1', 'Linto')
->setCellValue('Z1', 'Linto')
after Z1 what is the representation of cell in next row and column ?
Upvotes: 1
Views: 2921
Reputation: 1006
The column names used by PHPExcel match the column names seen in Excel. So after Z1, it goes to AA1, AB1, etc. (after AZ1 comes BA1).
So you can just use:
->setCellValue('AA1', 'Linto')
And as Mark pointed out, there is setCellValueByColumnAndRow which allow you to set cells using numeric indices:
->setCellValueByColumnAndRow($column, $row)
Note: that row is 1 based (i.e., row 1 is the first row) and column is 0 based (i.e., column 0 is the first column).
Upvotes: 7