im trying to cellAlignment right for number_format data only Total Share,Total Contribution and Monthly Contribution not all data at once, how i to make it? this is my code :
public function generateExcel(){
return response()->streamDownload(function () {
$header_style = (new StyleBuilder())
->setFontBold()
->setShouldWrapText(false)
->build();
$rows_style = (new StyleBuilder())
->setShouldWrapText(false)
->build();
$right_style = (new StyleBuilder())
->setCellAlignment(CellAlignment::RIGHT)
->build();
return (new FastExcel($this->renderReportList()))
->headerStyle($header_style)
->rowsStyle($rows_style)
->export('php://output' , function ($item) {
$data = [
'Membership No' => $item->ref_no,
'Name' => $item->name,
'Total Share' => number_format($item->total_share,2),
'Total Contribution' => number_format($item->total_contribution,2),
'Monthly Contribution' => number_format($item->monthly_contribution,2),
];
return $data;
});
}, sprintf('example-%s.xlsx',$this->startDate));