<?php
namespace App\Exports;
use Maatwebsite\Excel\Concerns\FromArray;
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
class InvoicesExport implements FromArray, WithColumnFormatting
{
protected $invoices;
public function __construct(array $invoices)
{
$this->invoices = $invoices;
}
function array(): array
{
return $this->invoices;
}
public function columnFormats(): array
{
return [
'A' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'B' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'C' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'D' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'E' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'F' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'G' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'H' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'I' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'J' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'K' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'L' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'M' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'N' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'O' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'P' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'Q' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'R' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'S' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'T' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'U' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'V' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'W' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'X' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'Y' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
'Z' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
];
}
}
网友评论