|
|
@@ -17,18 +17,20 @@ class Export extends StringValueBinder implements FromCollection,
|
|
|
private $data;
|
|
|
private $mergeCell;
|
|
|
private $columnName;
|
|
|
+ private $formatNumber;
|
|
|
|
|
|
/*
|
|
|
* $mergeCell $columnName :合并单元格所需参数;
|
|
|
* $mergeCell 需要合并的位置数组以MAP形式存储 [开始行=>结束行]
|
|
|
* $columnName 需要合并列 与合并行数结合使用ARRAY存储 ['A','B']
|
|
|
*/
|
|
|
- public function __construct($row,$data,$mergeCell=null,$columnName=null)
|
|
|
+ public function __construct($row,$data,$mergeCell=null,$columnName=null,$formatNumber=['D','H','I','L','O','Q','S','T','U','V'])
|
|
|
{
|
|
|
$this->row = $row;
|
|
|
$this->data = $data;
|
|
|
$this->mergeCell = $mergeCell;
|
|
|
$this->columnName = $columnName;
|
|
|
+ $this->formatNumber = $formatNumber;
|
|
|
}
|
|
|
|
|
|
public function collection()
|
|
|
@@ -70,18 +72,11 @@ class Export extends StringValueBinder implements FromCollection,
|
|
|
}
|
|
|
|
|
|
public function columnFormats(): array{
|
|
|
- return [
|
|
|
- 'D' => NumberFormat::FORMAT_TEXT,
|
|
|
- 'H' => NumberFormat::FORMAT_TEXT,
|
|
|
- 'I' => NumberFormat::FORMAT_TEXT,
|
|
|
- 'L' => NumberFormat::FORMAT_TEXT,
|
|
|
- 'O' => NumberFormat::FORMAT_TEXT,
|
|
|
- 'Q' => NumberFormat::FORMAT_TEXT,
|
|
|
- 'S' => NumberFormat::FORMAT_TEXT,
|
|
|
- 'T' => NumberFormat::FORMAT_TEXT,
|
|
|
- 'U' => NumberFormat::FORMAT_TEXT,
|
|
|
- 'V' => NumberFormat::FORMAT_TEXT,
|
|
|
- ];
|
|
|
+ $formatNumber = [];
|
|
|
+ foreach ($this->formatNumber as $column){
|
|
|
+ $formatNumber[$column] = NumberFormat::FORMAT_TEXT;
|
|
|
+ }
|
|
|
+ return $formatNumber;
|
|
|
}
|
|
|
}
|
|
|
|