我正在尝试将工作表的方向设置为全屏,同时将其导出为 pdf。这是我的代码
Excel::create('Benchmark Constituents', function($excel) use ($Array_data) {
$excel->setTitle('Benchmark Constituents');
$excel->setDescription('File containing Benchmark Constituents');
$excel->sheet('sheet1', function($sheet) use ($Array_data) {
$sheet->setOrientation('landscape');
$sheet->mergeCells('E1:G1');
$sheet->cell('E1', function($cell) {
$cell->setValue('Benchmark Constituents');
$cell->setAlignment('center');
$cell->setFontColor('#ffffff');
$cell->setBackground('##000000');
$cell->setFont(array(
'family' => 'Calibri',
'size' => '16',
'bold' => true
));
});
$sheet->fromArray($Array_data, null,"A3",true);
$sheet->row(3, function($row) {
$row->setBackground('#808080');
$row->setFontColor('#ffffff');
});
$sheet->row(1, function($row) {
$row->setBorder('none');
});
$sheet->row(2, function($row) {
$row->setBorder('none');
});
});
})->download('pdf');
我得到这个文件作为输出,一些表格列仅仅因为页面宽度而被隐藏: