I'm using Maatwebsite/Laravel-Excel. And I need to export a view file to xls format using the codes below.
Controller File:
public function excel(){
return Excel::download(new Export($id), 'test.xls');
}
Export File
public function __construct($id){
$this->id = $id;
}
public function view(): View {
$obj = Object::find($this->id);
return view('project.view', [
'var' => $obj,
]);
}
The exported file is looking a bit good.
But my concern is, how to make the cells , auto width, depending on the content, and the styles, border are gone.