按图纸索引加载文件并附加值
$download_file_name = 'DataFile';
Excel::selectSheetsByIndex(1)->load($file_path, function($reader) use () {
$reader->sheet('Sheet1', function($sheet) use () {
//if you want to add value append single value
$sheet->SetCellValue("A7", "Exporter");
//if want to append row
$sheet->appendRow($dispColArray);
});
}, 'UTF-8')->setFilename($download_file_name)->download('xls');
您还可以为图纸样式使用以下函数
-
对于图纸样式
$sheet->setStyle(array(
'font' => array(
'name' => 'Calibri',
'size' => 9,
'background' => '#ffffff'
)
));
-
合并单元格和设计
$sheet->mergeCells('A1:D4');
$sheet->cells('A1:D4', function($cells) {
$cells->setBackground('#ffffff');
});