优化excel导出
This commit is contained in:
parent
a5a05b1e88
commit
5face1c077
@ -61,25 +61,17 @@ class Excel
|
|||||||
*/
|
*/
|
||||||
protected function init()
|
protected function init()
|
||||||
{
|
{
|
||||||
if (property_exists($this->excel, 'memory')) {
|
$this->setMemoryLimit();
|
||||||
ini_set('memory_limit', $this->excel->memory);
|
|
||||||
}
|
|
||||||
|
|
||||||
// register worksheet for current excel
|
// register worksheet for current excel
|
||||||
$this->registerWorksheet();
|
$this->registerWorksheet();
|
||||||
|
|
||||||
// before save excel
|
// before save excel
|
||||||
$this->before();
|
$this->before();
|
||||||
|
|
||||||
// set excel title
|
// set excel title
|
||||||
$this->setTitle();
|
$this->setTitle();
|
||||||
|
|
||||||
// set excel headers
|
// set excel headers
|
||||||
$this->setExcelHeaders();
|
$this->setExcelHeaders();
|
||||||
|
|
||||||
// set cell width
|
// set cell width
|
||||||
$this->setSheetWidth();
|
$this->setSheetWidth();
|
||||||
|
|
||||||
// set worksheets
|
// set worksheets
|
||||||
$this->setWorksheets();
|
$this->setWorksheets();
|
||||||
}
|
}
|
||||||
|
@ -163,4 +163,17 @@ trait MacroExcel
|
|||||||
{
|
{
|
||||||
++$this->row;
|
++$this->row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置内存限制
|
||||||
|
*
|
||||||
|
* @time 2020年05月26日
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setMemoryLimit()
|
||||||
|
{
|
||||||
|
if (property_exists($this->excel, 'memory')) {
|
||||||
|
ini_set('memory_limit', $this->excel->memory);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
7
extend/catcher/library/excel/ShouldTaskContract.php
Normal file
7
extend/catcher/library/excel/ShouldTaskContract.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
namespace catcher\library\excel;
|
||||||
|
|
||||||
|
interface ShouldTaskContract
|
||||||
|
{
|
||||||
|
public function name();
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user